3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** * @link http://stackoverflow.com/q/24526493/367456 */ $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xxe [<!ENTITY foo "aaaaaa">]> <article/> XML; libxml_set_external_entity_loader(function() { var_dump(func_get_args()); return NULL; }); $doc = new DOMDocument; $doc->loadXML($xml, LIBXML_DTDLOAD); echo "----\n"; libxml_set_external_entity_loader(NULL); $doc = new DOMDocument; $doc->loadXML($xml, LIBXML_DTDLOAD);
based on jemmH
Output for 5.4.0 - 7.2.0
----
Output for 5.3.0 - 5.3.29
Fatal error: Call to undefined function libxml_set_external_entity_loader() in /in/h4Nuk on line 12
Process exited with code 255.
Output for 4.4.3 - 4.4.9, 5.1.0 - 5.1.1, 5.1.3 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/h4Nuk on line 12
Process exited with code 255.
Output for 4.4.2, 5.1.2
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/h4Nuk on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/h4Nuk on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/h4Nuk on line 12
Process exited with code 255.