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
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/pX2mO
function name:  (null)
number of ops:  33
compiled vars:  !0 = $buffer, !1 = $xml
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   7     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22%3F%3E%0A+%3C%21DOCTYPE+foo+%5B++%0A++%3C%21ELEMENT+foo+ANY+%3E%0A++%3C%21ENTITY+xxe+SYSTEM+%22data%3A%2F%2Ftext%2Fhtml%2Caaaa%22+%3E%5D%3E%3Cfoo%3E%26xxe%3B%3C%2Ffoo%3E'
  10     1        INIT_FCALL                                               'libxml_disable_entity_loader'
         2        SEND_VAL                                                 <true>
         3        DO_ICALL                                                 
  12     4        INIT_FCALL                                               'simplexml_load_string'
         5        SEND_VAR                                                 !0
         6        DO_ICALL                                         $4      
         7        ASSIGN                                                   !1, $4
  13     8        INIT_FCALL                                               'var_dump'
         9        SEND_VAR                                                 !1
        10        DO_ICALL                                                 
  14    11        ROPE_INIT                                     3  ~8      'trying+New+SimpleXMLElement%28'
        12        ROPE_ADD                                      1  ~8      ~8, !1
        13        ROPE_END                                      2  ~7      ~8, '%29'
        14        ECHO                                                     ~7
  15    15        NEW                                              $10     :2
        16        SEND_VAR_EX                                              !0
        17        DO_FCALL                                      0          
        18        ASSIGN                                                   !1, $10
  16    19        INIT_FCALL                                               'var_dump'
        20        SEND_VAR                                                 !1
        21        DO_ICALL                                                 
  18    22        ECHO                                                     'Enabling+LIBXML_NOENT+for+test+reasons'
  19    23        INIT_FCALL                                               'simplexml_load_string'
        24        SEND_VAR                                                 !0
        25        SEND_VAL                                                 'SimpleXMLElement'
        26        SEND_VAL                                                 2
        27        DO_ICALL                                         $14     
        28        ASSIGN                                                   !1, $14
  20    29        INIT_FCALL                                               'var_dump'
        30        SEND_VAR                                                 !1
        31        DO_ICALL                                                 
        32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.1.0