3v4l.org

run code in 300+ PHP versions simultaneously
<?php stream_wrapper_unregister('file'); stream_wrapper_register('file', InvalidStreamWrapper::class); echo '========file_get_contents' . PHP_EOL; echo file_get_contents('non-exists-file'); echo '========require' . PHP_EOL; require 'non-exists-file'; class InvalidStreamWrapper { public $context; private $content = "<?php echo time() . PHP_EOL; ?>\n"; private $counter = 0; public function stream_read($count) { if ($this->counter > 2) { return ''; } $this->counter++; return $this->content;; } public function stream_stat() { return true; } public function stream_open($path, $mode, $options, &$opened_path): bool { return true; } public function stream_eof(): bool { return true; } public function stream_set_option($option, $arg1, $arg2) { return true; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fFlO8
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'stream_wrapper_unregister'
          1        SEND_VAL                                                 'file'
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'stream_wrapper_register'
          4        SEND_VAL                                                 'file'
          5        SEND_VAL                                                 'InvalidStreamWrapper'
          6        DO_ICALL                                                 
    6     7        ECHO                                                     '%3D%3D%3D%3D%3D%3D%3D%3Dfile_get_contents%0A'
    7     8        INIT_FCALL                                               'file_get_contents'
          9        SEND_VAL                                                 'non-exists-file'
         10        DO_ICALL                                         $2      
         11        ECHO                                                     $2
    8    12        ECHO                                                     '%3D%3D%3D%3D%3D%3D%3D%3Drequire%0A'
    9    13        INCLUDE_OR_EVAL                                          'non-exists-file', REQUIRE
   48    14      > RETURN                                                   1

Class InvalidStreamWrapper:
Function stream_read:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fFlO8
function name:  stream_read
number of ops:  9
compiled vars:  !0 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        FETCH_OBJ_R                                      ~1      'counter'
          2        IS_SMALLER                                               2, ~1
          3      > JMPZ                                                     ~2, ->5
   22     4    > > RETURN                                                   ''
   24     5    >   PRE_INC_OBJ                                              'counter'
   26     6        FETCH_OBJ_R                                      ~4      'content'
          7      > RETURN                                                   ~4
   27     8*     > RETURN                                                   null

End of function stream_read

Function stream_stat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fFlO8
function name:  stream_stat
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E > > RETURN                                                   <true>
   32     1*     > RETURN                                                   null

End of function stream_stat

Function stream_open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fFlO8
function name:  stream_open
number of ops:  7
compiled vars:  !0 = $path, !1 = $mode, !2 = $options, !3 = $opened_path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   36     4      > RETURN                                                   <true>
   37     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function stream_open

Function stream_eof:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fFlO8
function name:  stream_eof
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E > > RETURN                                                   <true>
   42     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function stream_eof

Function stream_set_option:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fFlO8
function name:  stream_set_option
number of ops:  5
compiled vars:  !0 = $option, !1 = $arg1, !2 = $arg2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   46     3      > RETURN                                                   <true>
   47     4*     > RETURN                                                   null

End of function stream_set_option

End of class InvalidStreamWrapper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.23 ms | 1466 KiB | 16 Q