Skip to content

Commit 06379ea

Browse files
committed
tests: Explicitly wrap an XML call in libxml_disable_entity_loader()
As per https://www.php.net/manual/en/function.libxml-disable-entity-loader.php this is technically unnecessary. >However, as of libxml 2.9.0 entity substitution is disabled by default, >so there is no need to disable the loading of external entities. See also php/php-src#5867 >Since the release of libxml 2.9.0 in 2012 external entity loading is >disabled in libxml by default. This means that using >libxml_disable_entity_loader() is no longer needed. Hopefully helps prevent false positive reports from security scanning tools. Change-Id: I7cabc5b8d44813d709a11db2f219ae16260542c7
1 parent 5d5d36d commit 06379ea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/phan/bin/postprocess-phan.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ class CheckStyleSuppressor extends Suppressor {
6666
*/
6767
public function suppress( $input ) {
6868
$dom = new DOMDocument();
69+
70+
$oldDisable = libxml_disable_entity_loader( true );
6971
$dom->loadXML( $input );
72+
7073
$hasErrors = false;
7174
// DOMNodeList's are "live", convert to an array so it works as expected
7275
$files = [];
@@ -95,6 +98,7 @@ public function suppress( $input ) {
9598
}
9699
}
97100
echo $dom->saveXML();
101+
libxml_disable_entity_loader( $oldDisable );
98102

99103
return $hasErrors;
100104
}

0 commit comments

Comments
 (0)