3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PosixStream { private $fileHandle = null; private $host; private $position = 0; public function stream_open($path, $mode, $options, &$opened_path) { $url = parse_url($path); $o = ''; if ($options & STREAM_USE_PATH) { $o .= ' STREAM_USE_PATH'; } if ($options & STREAM_IGNORE_URL) { $o .= ' STREAM_IGNORE_URL'; } /*if ($options & STREAM_ENFORCE_SAFE_MODE) { $o .= ' STREAM_ENFORCE_SAFE_MODE'; }*/ if ($options & STREAM_REPORT_ERRORS) { $o .= ' STREAM_REPORT_ERRORS'; } if ($options & STREAM_MUST_SEEK) { $o .= ' STREAM_MUST_SEEK'; } exit($url['host'] . $url['path'] . "\n" . $mode . "\n" . ltrim($o)); //$this->host = parse_url($path, PHP_URL_HOST); //$this->fileHandle = fopen($); fopen(); return true; } public function stream_read($count) { return ''; } public function stream_write($data) { return 0; } public function stream_tell() { return 0; } public function stream_eof() { true; } public function stream_seek($offset, $whence = SEEK_SET) { return false; } public function stream_metadata($path, $option, $value) { exit($path . "\n" . $option . "\n" . $value); return false; } } stream_wrapper_register('steve', 'PosixStream'); $test = fopen('steve://t/e/test.txt', 'r+'); fclose($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VYXKC
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   INIT_FCALL                                               'stream_wrapper_register'
          1        SEND_VAL                                                 'steve'
          2        SEND_VAL                                                 'PosixStream'
          3        DO_ICALL                                                 
   63     4        INIT_FCALL                                               'fopen'
          5        SEND_VAL                                                 'steve%3A%2F%2Ft%2Fe%2Ftest.txt'
          6        SEND_VAL                                                 'r%2B'
          7        DO_ICALL                                         $2      
          8        ASSIGN                                                   !0, $2
   65     9        INIT_FCALL                                               'fclose'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Class PosixStream:
Function stream_open:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 18
Branch analysis from position: 15
Branch analysis from position: 12
filename:       /in/VYXKC
function name:  stream_open
number of ops:  36
compiled vars:  !0 = $path, !1 = $mode, !2 = $options, !3 = $opened_path, !4 = $url, !5 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   11     4        INIT_FCALL                                               'parse_url'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !4, $6
   12     8        ASSIGN                                                   !5, ''
   13     9        BW_AND                                           ~9      !2, 1
         10      > JMPZ                                                     ~9, ->12
   14    11    >   ASSIGN_OP                                     8          !5, '+STREAM_USE_PATH'
   16    12    >   BW_AND                                           ~11     !2, 2
         13      > JMPZ                                                     ~11, ->15
   17    14    >   ASSIGN_OP                                     8          !5, '+STREAM_IGNORE_URL'
   22    15    >   BW_AND                                           ~13     !2, 8
         16      > JMPZ                                                     ~13, ->18
   23    17    >   ASSIGN_OP                                     8          !5, '+STREAM_REPORT_ERRORS'
   25    18    >   BW_AND                                           ~15     !2, 16
         19      > JMPZ                                                     ~15, ->21
   26    20    >   ASSIGN_OP                                     8          !5, '+STREAM_MUST_SEEK'
   28    21    >   FETCH_DIM_R                                      ~17     !4, 'host'
         22        FETCH_DIM_R                                      ~18     !4, 'path'
         23        CONCAT                                           ~19     ~17, ~18
         24        CONCAT                                           ~20     ~19, '%0A'
         25        CONCAT                                           ~21     ~20, !1
         26        CONCAT                                           ~22     ~21, '%0A'
         27        INIT_FCALL                                               'ltrim'
         28        SEND_VAR                                                 !5
         29        DO_ICALL                                         $23     
         30        CONCAT                                           ~24     ~22, $23
         31      > EXIT                                                     ~24
   31    32*       INIT_FCALL                                               'fopen'
         33*       DO_ICALL                                                 
   32    34*       RETURN                                                   <true>
   33    35*     > RETURN                                                   null

End of function stream_open

Function stream_read:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VYXKC
function name:  stream_read
number of ops:  3
compiled vars:  !0 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   36     1      > RETURN                                                   ''
   37     2*     > RETURN                                                   null

End of function stream_read

Function stream_write:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VYXKC
function name:  stream_write
number of ops:  3
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
   40     1      > RETURN                                                   0
   41     2*     > RETURN                                                   null

End of function stream_write

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

End of function stream_tell

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

End of function stream_eof

Function stream_seek:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VYXKC
function name:  stream_seek
number of ops:  4
compiled vars:  !0 = $offset, !1 = $whence
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
   52     2      > RETURN                                                   <false>
   53     3*     > RETURN                                                   null

End of function stream_seek

Function stream_metadata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/VYXKC
function name:  stream_metadata
number of ops:  10
compiled vars:  !0 = $path, !1 = $option, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   56     3        CONCAT                                           ~3      !0, '%0A'
          4        CONCAT                                           ~4      ~3, !1
          5        CONCAT                                           ~5      ~4, '%0A'
          6        CONCAT                                           ~6      ~5, !2
          7      > EXIT                                                     ~6
   57     8*       RETURN                                                   <false>
   58     9*     > RETURN                                                   null

End of function stream_metadata

End of class PosixStream.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.56 ms | 1404 KiB | 23 Q