diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02d46bf..21cfbf2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,8 +50,6 @@ jobs: - name: PHPStan run: composer phpstan - name: Code Style Check - env: - PHP_CS_FIXER_IGNORE_ENV: true run: composer style-check -- --format=checkstyle | cs2pr - name: Test run: composer test-with-coverage diff --git a/src/Zend/Xml/Security.php b/src/Zend/Xml/Security.php index d2edb57..9bb3302 100644 --- a/src/Zend/Xml/Security.php +++ b/src/Zend/Xml/Security.php @@ -84,7 +84,9 @@ public static function scan($xml, DOMDocument $dom = null) } if (!self::isPhpFpm()) { - $loadEntities = libxml_disable_entity_loader(true); + if (version_compare(PHP_VERSION, '8.0.0', 'lt')) { + $loadEntities = libxml_disable_entity_loader(true); + } $useInternalXmlErrors = libxml_use_internal_errors(true); } @@ -98,7 +100,9 @@ public static function scan($xml, DOMDocument $dom = null) if (!$result) { // Entity load to previous setting if (!self::isPhpFpm()) { - libxml_disable_entity_loader($loadEntities); + if (version_compare(PHP_VERSION, '8.0.0', 'lt')) { + libxml_disable_entity_loader($loadEntities); + } libxml_use_internal_errors($useInternalXmlErrors); } return false; @@ -120,7 +124,9 @@ public static function scan($xml, DOMDocument $dom = null) // Entity load to previous setting if (!self::isPhpFpm()) { - libxml_disable_entity_loader($loadEntities); + if (version_compare(PHP_VERSION, '8.0.0', 'lt')) { + libxml_disable_entity_loader($loadEntities); + } libxml_use_internal_errors($useInternalXmlErrors); }