3v4l.org

run code in 500+ PHP versions simultaneously
<?php $xml = <<<'XML' <AIUTO><BASE_GIURIDICA_NAZIONALE>Quadro riepilogativo delle misure a sostegno delle imprese attive nei settori agricolo, forestale, della pesca e acquacoltura ai sensi della Comunicazione della Commissione europea C (2020) 1863 final – “Quadro temporaneo per le misure di aiuto di Stato a sostegno dell’economia nell’attuale emergenza del COVID&#2;19” e successive modifiche e integrazioni</BASE_GIURIDICA_NAZIONALE></AIUTO> XML; class fix_entities_filter extends php_user_filter { function filter($in, $out, &$consumed, bool $closing): int { while ($bucket = stream_bucket_make_writeable($in)) { $bucket->data = $this->fix($bucket->data); $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; } function fix($data) { return strtr($data, ['&#2;' => '&#x202f;']); } } stream_filter_register("fix_entities", "fix_entities_filter") or die("Failed to register filter"); $fileNamePath = "php://filter/read=fix_entities/resource=data:text/plain;base64," . base64_encode($xml); $reader = new XMLReader(); if (!$reader->open($fileNamePath)) { echo "Error opening file: $fileNamePath", PHP_EOL; } echo "Processing XML", PHP_EOL; while ($reader->read()) { if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'AIUTO') { try { $input = $reader->readOuterXML(); $nodeAiuto = new SimpleXMLElement($input); var_dump($nodeAiuto); } catch(Exception $e) { echo "Error Node AIUTO ", $e->getMessage(), PHP_EOL; continue; } //Do stuff here } } $reader->close();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 61) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 30
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 55
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
Branch analysis from position: 55
Branch analysis from position: 36
Branch analysis from position: 27
Found catch point at position: 48
Branch analysis from position: 48
2 jumps found. (Code = 107) Position 1 = 49, Position 2 = -2
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
filename:       /in/6lTrp
function name:  (null)
number of ops:  61
compiled vars:  !0 = $xml, !1 = $fileNamePath, !2 = $reader, !3 = $input, !4 = $nodeAiuto, !5 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3CAIUTO%3E%3CBASE_GIURIDICA_NAZIONALE%3EQuadro+riepilogativo+delle+misure+a+sostegno+delle+imprese+attive+nei+settori+agricolo%2C+forestale%2C+della+pesca+%0Ae+acquacoltura+ai+sensi+della+Comunicazione+della+Commissione+europea+C+%282020%29+1863+final+%E2%80%93+%E2%80%9CQuadro+%0Atemporaneo+per+le+misure+di+aiuto+di+Stato+a+sostegno+dell%E2%80%99economia+nell%E2%80%99attuale+emergenza+del+COVID%26%232%3B19%E2%80%9D+e+successive+modifiche+e+integrazioni%3C%2FBASE_GIURIDICA_NAZIONALE%3E%3C%2FAIUTO%3E'
   25     1        INIT_FCALL                                                   'stream_filter_register'
          2        SEND_VAL                                                     'fix_entities'
          3        SEND_VAL                                                     'fix_entities_filter'
          4        DO_ICALL                                             $7      
          5      > JMPNZ_EX                                             ~8      $7, ->10
   26     6    > > INIT_FCALL                                                   'exit'
          7*       SEND_VAL                                                     'Failed+to+register+filter'
          8*       DO_ICALL                                             $9      
          9*       BOOL                                                 ~8      $9
   28    10    >   INIT_FCALL                                                   'base64_encode'
         11        SEND_VAR                                                     !0
         12        DO_ICALL                                             $10     
         13        CONCAT                                               ~11     'php%3A%2F%2Ffilter%2Fread%3Dfix_entities%2Fresource%3Ddata%3Atext%2Fplain%3Bbase64%2C', $10
         14        ASSIGN                                                       !1, ~11
   30    15        NEW                                                  $13     'XMLReader'
         16        DO_FCALL                                          0          
         17        ASSIGN                                                       !2, $13
   32    18        INIT_METHOD_CALL                                             !2, 'open'
         19        SEND_VAR_EX                                                  !1
         20        DO_FCALL                                          0  $16     
         21        BOOL_NOT                                             ~17     $16
         22      > JMPZ                                                         ~17, ->27
   33    23    >   NOP                                                          
         24        FAST_CONCAT                                          ~18     'Error+opening+file%3A+', !1
         25        ECHO                                                         ~18
         26        ECHO                                                         '%0A'
   36    27    >   ECHO                                                         'Processing+XML'
         28        ECHO                                                         '%0A'
   38    29      > JMP                                                          ->55
   39    30    >   FETCH_OBJ_R                                          ~19     !2, 'nodeType'
         31        IS_EQUAL                                             ~20     ~19, 1
         32      > JMPZ_EX                                              ~20     ~20, ->36
         33    >   FETCH_OBJ_R                                          ~21     !2, 'name'
         34        IS_EQUAL                                             ~22     ~21, 'AIUTO'
         35        BOOL                                                 ~20     ~22
         36    > > JMPZ                                                         ~20, ->55
   41    37    >   INIT_METHOD_CALL                                             !2, 'readOuterXML'
         38        DO_FCALL                                          0  $23     
         39        ASSIGN                                                       !3, $23
   42    40        NEW                                                  $25     'SimpleXMLElement'
         41        SEND_VAR_EX                                                  !3
         42        DO_FCALL                                          0          
         43        ASSIGN                                                       !4, $25
   43    44        INIT_FCALL                                                   'var_dump'
         45        SEND_VAR                                                     !4
         46        DO_ICALL                                                     
         47      > JMP                                                          ->55
   45    48  E > > CATCH                                           last         'Exception'
   46    49    >   ECHO                                                         'Error+Node+AIUTO+'
         50        INIT_METHOD_CALL                                             !5, 'getMessage'
         51        DO_FCALL                                          0  $29     
         52        ECHO                                                         $29
         53        ECHO                                                         '%0A'
   47    54      > JMP                                                          ->55
   38    55    >   INIT_METHOD_CALL                                             !2, 'read'
         56        DO_FCALL                                          0  $30     
         57      > JMPNZ                                                        $30, ->30
   54    58    >   INIT_METHOD_CALL                                             !2, 'close'
         59        DO_FCALL                                          0          
         60      > RETURN                                                       1

Class fix_entities_filter:
Function filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 5
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 5
Branch analysis from position: 23
Branch analysis from position: 5
filename:       /in/6lTrp
function name:  filter
number of ops:  26
compiled vars:  !0 = $in, !1 = $out, !2 = $consumed, !3 = $closing, !4 = $bucket
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV                                                 !3      
   11     4      > JMP                                                          ->18
   12     5    >   INIT_METHOD_CALL                                             'fix'
          6        CHECK_FUNC_ARG                                               
          7        FETCH_OBJ_FUNC_ARG                                   $6      !4, 'data'
          8        SEND_FUNC_ARG                                                $6
          9        DO_FCALL                                          0  $7      
         10        ASSIGN_OBJ                                                   !4, 'data'
         11        OP_DATA                                                      $7
   13    12        FETCH_OBJ_R                                          ~8      !4, 'datalen'
         13        ASSIGN_OP                                         1          !2, ~8
   14    14        INIT_FCALL                                                   'stream_bucket_append'
         15        SEND_VAR                                                     !1
         16        SEND_VAR                                                     !4
         17        DO_ICALL                                                     
   11    18    >   INIT_FCALL                                                   'stream_bucket_make_writeable'
         19        SEND_VAR                                                     !0
         20        DO_ICALL                                             $11     
         21        ASSIGN                                               ~12     !4, $11
         22      > JMPNZ                                                        ~12, ->5
   16    23    > > RETURN                                                       2
   17    24*       VERIFY_RETURN_TYPE                                           
         25*     > RETURN                                                       null

End of function filter

Function fix:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6lTrp
function name:  fix
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
   21     1        FRAMELESS_ICALL_2                strtr               ~1      !0, <array>
          2      > RETURN                                                       ~1
   22     3*     > RETURN                                                       null

End of function fix

End of class fix_entities_filter.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
216.67 ms | 1549 KiB | 19 Q