3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** * @link http://stackoverflow.com/a/29864193/367456 */ $buffer = <<<XML <?xml version="1.0"?><!DOCTYPE xml <!-- ==================================== xhtml-lat1.ent ==================================== --> <!-- Portions (C) International Organization for Standardization 1986 Permission to copy in any form is granted for use with conforming SGML systems and applications as defined in ISO 8879, provided this notice is included in all copies. --> <!-- Character entity set. Typical invocation: <!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"> %HTMLlat1; --> <!ENTITY nbsp "&#160;"> <!-- no-break space = non-breaking space, U+00A0 ISOnum --> ]><foo>&nbsp;</foo> XML; libxml_disable_entity_loader(false); $xml = simplexml_load_string($buffer); $xml->asXML('php://output'); $xml = simplexml_load_string($buffer, 'SimpleXMLElement', LIBXML_NOENT); $xml->asXML('php://output');
based on iLvu6
Output for 7.0.0 - 7.2.0
Warning: simplexml_load_string(): Entity: line 3: parser error : DOCTYPE improperly terminated in /in/rg5XA on line 35 Warning: simplexml_load_string(): <!-- in /in/rg5XA on line 35 Warning: simplexml_load_string(): ^ in /in/rg5XA on line 35 Warning: simplexml_load_string(): Entity: line 3: parser error : Start tag expected, '<' not found in /in/rg5XA on line 35 Warning: simplexml_load_string(): <!-- in /in/rg5XA on line 35 Warning: simplexml_load_string(): ^ in /in/rg5XA on line 35 Fatal error: Uncaught Error: Call to a member function asXML() on boolean in /in/rg5XA:36 Stack trace: #0 {main} thrown in /in/rg5XA on line 36
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Warning: simplexml_load_string(): Entity: line 3: parser error : DOCTYPE improperly terminated in /in/rg5XA on line 35 Warning: simplexml_load_string(): <!-- in /in/rg5XA on line 35 Warning: simplexml_load_string(): ^ in /in/rg5XA on line 35 Warning: simplexml_load_string(): Entity: line 3: parser error : Start tag expected, '<' not found in /in/rg5XA on line 35 Warning: simplexml_load_string(): <!-- in /in/rg5XA on line 35 Warning: simplexml_load_string(): ^ in /in/rg5XA on line 35 Fatal error: Call to a member function asXML() on boolean in /in/rg5XA on line 36
Process exited with code 255.
Output for 5.3.17 - 5.5.35
Warning: simplexml_load_string(): Entity: line 3: parser error : DOCTYPE improperly terminated in /in/rg5XA on line 35 Warning: simplexml_load_string(): <!-- in /in/rg5XA on line 35 Warning: simplexml_load_string(): ^ in /in/rg5XA on line 35 Warning: simplexml_load_string(): Entity: line 3: parser error : Start tag expected, '<' not found in /in/rg5XA on line 35 Warning: simplexml_load_string(): <!-- in /in/rg5XA on line 35 Warning: simplexml_load_string(): ^ in /in/rg5XA on line 35 Fatal error: Call to a member function asXML() on a non-object in /in/rg5XA on line 36
Process exited with code 255.