3v4l.org

run code in 300+ 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 = 8
Branch analysis from position: 6
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 28
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 34
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 53
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 53
Branch analysis from position: 34
Branch analysis from position: 25
Found catch point at position: 46
Branch analysis from position: 46
2 jumps found. (Code = 107) Position 1 = 47, Position 2 = -2
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
filename:       /in/6lTrp
function name:  (null)
number of ops:  59
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, ->8
   26     6    > > EXIT                                                     'Failed+to+register+filter'
          7*       BOOL                                             ~8      <true>
   28     8    >   INIT_FCALL                                               'base64_encode'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $9      
         11        CONCAT                                           ~10     'php%3A%2F%2Ffilter%2Fread%3Dfix_entities%2Fresource%3Ddata%3Atext%2Fplain%3Bbase64%2C', $9
         12        ASSIGN                                                   !1, ~10
   30    13        NEW                                              $12     'XMLReader'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !2, $12
   32    16        INIT_METHOD_CALL                                         !2, 'open'
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0  $15     
         19        BOOL_NOT                                         ~16     $15
         20      > JMPZ                                                     ~16, ->25
   33    21    >   NOP                                                      
         22        FAST_CONCAT                                      ~17     'Error+opening+file%3A+', !1
         23        ECHO                                                     ~17
         24        ECHO                                                     '%0A'
   36    25    >   ECHO                                                     'Processing+XML'
         26        ECHO                                                     '%0A'
   38    27      > JMP                                                      ->53
   39    28    >   FETCH_OBJ_R                                      ~18     !2, 'nodeType'
         29        IS_EQUAL                                         ~19     ~18, 1
         30      > JMPZ_EX                                          ~19     ~19, ->34
         31    >   FETCH_OBJ_R                                      ~20     !2, 'name'
         32        IS_EQUAL                                         ~21     ~20, 'AIUTO'
         33        BOOL                                             ~19     ~21
         34    > > JMPZ                                                     ~19, ->53
   41    35    >   INIT_METHOD_CALL                                         !2, 'readOuterXML'
         36        DO_FCALL                                      0  $22     
         37        ASSIGN                                                   !3, $22
   42    38        NEW                                              $24     'SimpleXMLElement'
         39        SEND_VAR_EX                                              !3
         40        DO_FCALL                                      0          
         41        ASSIGN                                                   !4, $24
   43    42        INIT_FCALL                                               'var_dump'
         43        SEND_VAR                                                 !4
         44        DO_ICALL                                                 
         45      > JMP                                                      ->53
   45    46  E > > CATCH                                       last         'Exception'
   46    47    >   ECHO                                                     'Error+Node+AIUTO+'
         48        INIT_METHOD_CALL                                         !5, 'getMessage'
         49        DO_FCALL                                      0  $28     
         50        ECHO                                                     $28
         51        ECHO                                                     '%0A'
   47    52      > JMP                                                      ->53
   38    53    >   INIT_METHOD_CALL                                         !2, 'read'
         54        DO_FCALL                                      0  $29     
         55      > JMPNZ                                                    $29, ->28
   54    56    >   INIT_METHOD_CALL                                         !2, 'close'
         57        DO_FCALL                                      0          
         58      > 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:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        INIT_FCALL                                               'strtr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <array>
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
   22     6*     > RETURN                                                   null

End of function fix

End of class fix_entities_filter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.87 ms | 1025 KiB | 19 Q