3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $buffer = <<<XML <?xml version="1.0"?> <!DOCTYPE foo [ <!ELEMENT foo ANY > <!ENTITY xxe SYSTEM "data://text/html,aaaa" >]><foo>&xxe;</foo> XML; libxml_disable_entity_loader(true); $xml = simplexml_load_string($buffer); var_dump($xml); echo "trying New SimpleXMLElement($xml)"; $xml = new SimpleXMLElement($buffer); var_dump($xml); echo 'Enabling LIBXML_NOENT for test reasons'; $xml = simplexml_load_string($buffer, 'SimpleXMLElement', LIBXML_NOENT); var_dump($xml);
based on rXQOo

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Arrow functions
object(SimpleXMLElement)#1 (1) { ["xxe"]=> object(SimpleXMLElement)#2 (1) { ["xxe"]=> object(SimpleXMLElement)#3 (0) { } } } trying New SimpleXMLElement()object(SimpleXMLElement)#2 (1) { ["xxe"]=> object(SimpleXMLElement)#1 (1) { ["xxe"]=> object(SimpleXMLElement)#3 (0) { } } } Enabling LIBXML_NOENT for test reasons Warning: simplexml_load_string(): I/O warning : failed to load external entity "data://text/html,aaaa" in /in/pX2mO on line 19 Warning: simplexml_load_string(): Entity: line 4: parser error : Failure to process entity xxe in /in/pX2mO on line 19 Warning: simplexml_load_string(): <!ENTITY xxe SYSTEM "data://text/html,aaaa" >]><foo>&xxe;</foo> in /in/pX2mO on line 19 Warning: simplexml_load_string(): ^ in /in/pX2mO on line 19 Warning: simplexml_load_string(): Entity: line 4: parser error : Entity 'xxe' not defined in /in/pX2mO on line 19 Warning: simplexml_load_string(): <!ENTITY xxe SYSTEM "data://text/html,aaaa" >]><foo>&xxe;</foo> in /in/pX2mO on line 19 Warning: simplexml_load_string(): ^ in /in/pX2mO on line 19 bool(false)

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page