Skip to content

Commit 7523ee8

Browse files
committed
Set new default of we can
1 parent 8e17793 commit 7523ee8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/DOMDocumentFactory.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use SimpleSAML\XML\Exception\UnparseableXMLException;
1212

1313
use function file_get_contents;
14+
use function func_num_args;
1415
use function libxml_clear_errors;
1516
use function libxml_get_last_error;
1617
use function libxml_set_external_entity_loader;
@@ -51,6 +52,11 @@ public static function fromString(
5152
$internalErrors = libxml_use_internal_errors(true);
5253
libxml_clear_errors();
5354

55+
// If LIBXML_NO_XXE is available and option not set
56+
if (func_num_args() === 1 && defined('LIBXML_NO_XXE')) {
57+
$options != LIBXML_NO_XXE;
58+
}
59+
5460
$domDocument = self::create();
5561
$loaded = $domDocument->loadXML($xml, $options);
5662

@@ -95,7 +101,7 @@ public static function fromFile(string $file, int $options = self::DEFAULT_OPTIO
95101
}
96102

97103
Assert::notWhitespaceOnly($xml, sprintf('File "%s" does not have content', $file), RuntimeException::class);
98-
return static::fromString($xml, $options);
104+
return (func_num_args() === 1) ? static::fromString($xml) : static::fromString($xml, $options);
99105
}
100106

101107

0 commit comments

Comments
 (0)