From d0dea580ad06e04d34d9912daaa02e6e7d42932f Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Wed, 2 Jan 2019 15:38:13 +1100 Subject: [PATCH] Fix a few Scrutinizer issues --- src/PhpSpreadsheet/Reader/Security/XmlScanner.php | 2 +- .../Reader/Security/XmlScannerTest.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PhpSpreadsheet/Reader/Security/XmlScanner.php b/src/PhpSpreadsheet/Reader/Security/XmlScanner.php index a8025063..b5f7ac60 100644 --- a/src/PhpSpreadsheet/Reader/Security/XmlScanner.php +++ b/src/PhpSpreadsheet/Reader/Security/XmlScanner.php @@ -101,7 +101,7 @@ class XmlScanner $xml = call_user_func($this->callback, $xml); } } finally { - if ($this->libxmlDisableEntityLoader) { + if (isset($previousLibxmlDisableEntityLoaderValue)) { libxml_disable_entity_loader($previousLibxmlDisableEntityLoaderValue); } } diff --git a/tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php b/tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php index ea9aff0b..ca813a03 100644 --- a/tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php +++ b/tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php @@ -119,15 +119,15 @@ class XmlScannerTest extends TestCase /** * @dataProvider providerLibxmlSettings * - * @param $libxmDisableLoader + * @param $libxmlDisableLoader */ - public function testNewInstanceCreationDoesntChangeLibxmlSettings($libxmDisableLoader) + public function testNewInstanceCreationDoesntChangeLibxmlSettings($libxmlDisableLoader) { - libxml_disable_entity_loader($libxmDisableLoader); + libxml_disable_entity_loader($libxmlDisableLoader); $reader = new Xml(); - - self::assertEquals($libxmDisableLoader, libxml_disable_entity_loader($libxmDisableLoader)); + self::assertEquals($libxmlDisableLoader, libxml_disable_entity_loader($libxmlDisableLoader)); + unset($reader); } public function providerLibxmlSettings()