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 "/etc/passwd"> ] > <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 6qWmf
Output for 7.1.10, 7.2.0, 7.3.0alpha1 - 7.3.0rc3
root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/usr/bin/nologin daemon:x:2:2:daemon:/:/usr/bin/nologin mail:x:8:12:mail:/var/spool/mail:/usr/bin/nologin ftp:x:14:11:ftp:/srv/ftp:/usr/bin/nologin http:x:33:33:http:/srv/http:/usr/bin/nologin nobody:x:99:99:nobody:/:/usr/bin/nologin systemd-journal-gateway:x:191:191:systemd-journal-gateway:/:/usr/bin/nologin systemd-timesync:x:192:192:systemd-timesync:/:/usr/bin/nologin systemd-network:x:193:193:systemd-network:/:/usr/bin/nologin systemd-bus-proxy:x:194:194:systemd-bus-proxy:/:/usr/bin/nologin systemd-resolve:x:195:195:systemd-resolve:/:/usr/bin/nologin
Output for 7.0.0 - 7.1.7, 7.1.20, 7.2.6
Warning: SimpleXMLElement::__construct(): I/O warning : failed to load external entity "/etc/passwd" in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Failure to process entity shp in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): <komentarz> &shp;</komentarz> in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Entity 'shp' not defined in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): <komentarz> &shp;</komentarz> in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/mnTQv on line 14 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/mnTQv:14 Stack trace: #0 /in/mnTQv(14): SimpleXMLElement->__construct('<?xml version="...', 2) #1 {main} thrown in /in/mnTQv on line 14
Process exited with code 255.
Output for hhvm-3.15.4
Warning: Protocol 'file' for external XML entity '/etc/passwd' is disabled for security reasons. This may be changed using the hhvm.libxml.ext_entity_whitelist ini setting. in /in/mnTQv on line 14 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/mnTQv:14 Stack trace: #0 /in/mnTQv(14): SimpleXMLElement->__construct() #1 {main} Entity: line 9: parser error : Failure to process entity shp <komentarz> &shp;</komentarz> ^ Entity: line 9: parser error : Entity 'shp' not defined <komentarz> &shp;</komentarz> ^
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: SimpleXMLElement::__construct(): I/O warning : failed to load external entity "/etc/passwd" in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Failure to process entity shp in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): <komentarz> &shp;</komentarz> in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Entity 'shp' not defined in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): <komentarz> &shp;</komentarz> in /in/mnTQv on line 14 Warning: SimpleXMLElement::__construct(): ^ in /in/mnTQv on line 14 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/mnTQv:14 Stack trace: #0 /in/mnTQv(14): SimpleXMLElement->__construct('<?xml version="...', 2) #1 {main} thrown in /in/mnTQv on line 14
Process exited with code 255.