--TEST-- Disable XXE --SKIPIF-- --INI-- sp.configuration_file={PWD}/config/disable_xxe_disable.ini --FILE-- WARNING, external entity loaded!'; file_put_contents($dir . '/content.txt', $content); $xml = << ]> &foo; EOD; file_put_contents($dir . '/content.xml', $xml); libxml_disable_entity_loader(true); $dom = new DOMDocument('1.0'); $dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); printf("libxml_disable_entity to true: %s\n", $dom->getElementsByTagName('testing')->item(0)->nodeValue); libxml_disable_entity_loader(false); $dom = new DOMDocument('1.0'); $dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); printf("libxml_disable_entity to false: %s\n", $dom->getElementsByTagName('testing')->item(0)->nodeValue); $xml = "foo"; file_put_contents('content.xml', $xml); libxml_disable_entity_loader(false); $dom = new DOMDocument('1.0'); $dom->loadXML($xml, LIBXML_DTDATTR|LIBXML_DTDLOAD|LIBXML_NOENT); printf("without xxe: %s", $dom->getElementsByTagName('testing')->item(0)->nodeValue); ?> --EXPECTF-- libxml_disable_entity to true: WARNING, external entity loaded! libxml_disable_entity to false: WARNING, external entity loaded! without xxe: foo --CLEAN--