Skip to content

Commit

Permalink
Set new default of we can
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Nov 27, 2024
1 parent 8e17793 commit 7523ee8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/DOMDocumentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use SimpleSAML\XML\Exception\UnparseableXMLException;

use function file_get_contents;
use function func_num_args;
use function libxml_clear_errors;
use function libxml_get_last_error;
use function libxml_set_external_entity_loader;
Expand Down Expand Up @@ -51,6 +52,11 @@ public static function fromString(
$internalErrors = libxml_use_internal_errors(true);
libxml_clear_errors();

// If LIBXML_NO_XXE is available and option not set
if (func_num_args() === 1 && defined('LIBXML_NO_XXE')) {
$options != LIBXML_NO_XXE;
}

$domDocument = self::create();
$loaded = $domDocument->loadXML($xml, $options);

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

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


Expand Down

0 comments on commit 7523ee8

Please sign in to comment.