Skip to content

Commit 6ef8857

Browse files
committed
library working with php8
1 parent 9ffb241 commit 6ef8857

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"source": "https://github.com/onelogin/php-saml/"
1616
},
1717
"require": {
18-
"php": ">=5.4 <8.0",
18+
"php": ">=5.4",
1919
"robrichards/xmlseclibs": ">=3.1.1",
2020
"phpunit/phpunit": "<7.5.18"
2121
},

src/Saml2/Utils.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,16 @@ public static function loadXML(DOMDocument $dom, $xml)
8282
assert($dom instanceof DOMDocument);
8383
assert(is_string($xml));
8484

85-
$oldEntityLoader = libxml_disable_entity_loader(true);
85+
$oldEntityLoader = null;
86+
if (PHP_VERSION_ID < 80000) {
87+
$oldEntityLoader = libxml_disable_entity_loader(true);
88+
}
8689

8790
$res = $dom->loadXML($xml);
8891

89-
libxml_disable_entity_loader($oldEntityLoader);
92+
if (PHP_VERSION_ID < 80000) {
93+
libxml_disable_entity_loader($oldEntityLoader);
94+
}
9095

9196
foreach ($dom->childNodes as $child) {
9297
if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
@@ -141,9 +146,14 @@ public static function validateXML($xml, $schema, $debug = false, $schemaPath =
141146
$schemaFile = __DIR__ . '/schemas/' . $schema;
142147
}
143148

144-
$oldEntityLoader = libxml_disable_entity_loader(false);
149+
$oldEntityLoader = null;
150+
if (PHP_VERSION_ID < 80000) {
151+
$oldEntityLoader = libxml_disable_entity_loader(false);
152+
}
145153
$res = $dom->schemaValidate($schemaFile);
146-
libxml_disable_entity_loader($oldEntityLoader);
154+
if (PHP_VERSION_ID < 80000) {
155+
libxml_disable_entity_loader($oldEntityLoader);
156+
}
147157
if (!$res) {
148158
$xmlErrors = libxml_get_errors();
149159
syslog(LOG_INFO, 'Error validating the metadata: '.var_export($xmlErrors, true));

0 commit comments

Comments
 (0)