3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE strony [ <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> ] > <strony> <strona id="cccc"> <nazwa>bbbb</nazwa> <url>http://www.aaaa.pl/</url> <komentarz> &shp;</komentarz> </strona> </strony>'; $strony = new SimpleXMLElement($xml, LIBXML_NOENT); foreach($strony->strona->komentarz as $komentarz) echo "$komentarz\n";
based on TWceD
Output for 7.0.0 - 7.3.0rc3
Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Invalid URI: php://echo dir(\ in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Space required before 'NDATA' in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : xmlParseEntityDecl: entity shp not terminated in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/gaFiQ on line 14 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/gaFiQ:14 Stack trace: #0 /in/gaFiQ(14): SimpleXMLElement->__construct('<?xml version="...', 2) #1 {main} thrown in /in/gaFiQ on line 14
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/gaFiQ:14 Stack trace: #0 /in/gaFiQ(14): SimpleXMLElement->__construct() #1 {main} Entity: line 3: parser error : Invalid URI: php://echo dir(\ <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> ^ Entity: line 3: parser error : Space required before 'NDATA' <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> ^ Entity: line 3: parser error : xmlParseEntityDecl: entity shp not terminated <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> ^
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Invalid URI: php://echo dir(\ in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Space required before 'NDATA' in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : xmlParseEntityDecl: entity shp not terminated in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): <!ENTITY shp SYSTEM "php://echo dir(\"/etc\");"> in /in/gaFiQ on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/gaFiQ on line 14 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/gaFiQ:14 Stack trace: #0 /in/gaFiQ(14): SimpleXMLElement->__construct('<?xml version="...', 2) #1 {main} thrown in /in/gaFiQ on line 14
Process exited with code 255.