3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SourceTransformingLoader extends php_user_filter { /** * Php filter definition */ const PHP_FILTER_READ = 'php://filter/read='; /** * Default PHP filter name for registration */ const FILTER_IDENTIFIER = 'go.source.transforming.loader'; /** * String buffer * * @var string */ protected $data = ''; /** * Identifier of filter * * @var string */ protected static $filterId; /** * Register current loader as stream filter in PHP * * @param string $filterId Identifier for the filter * @throws \RuntimeException If registration was failed */ public static function register($filterId = self::FILTER_IDENTIFIER) { if (!empty(self::$filterId)) { throw new \RuntimeException('Stream filter already registered'); } $result = stream_filter_register($filterId, __CLASS__); if (!$result) { throw new RuntimeException('Stream filter was not registered'); } self::$filterId = $filterId; } /** * {@inheritdoc} */ public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $this->data .= $bucket->data; } if ($closing || feof($this->stream)) { $consumed = strlen($this->data); $bucket = stream_bucket_new($this->stream, $this->data); stream_bucket_append($out, $bucket); return PSFS_PASS_ON; } return PSFS_FEED_ME; } } SourceTransformingLoader::register(); echo file_get_contents('php://filter/read=go.source.transforming.loader/resource=' . __FILE__);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bF4WL
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   72     0  E >   INIT_STATIC_METHOD_CALL                                  'SourceTransformingLoader', 'register'
          1        DO_FCALL                                      0          
   74     2        INIT_FCALL                                               'file_get_contents'
          3        SEND_VAL                                                 'php%3A%2F%2Ffilter%2Fread%3Dgo.source.transforming.loader%2Fresource%3D%2Fin%2FbF4WL'
          4        DO_ICALL                                         $1      
          5        ECHO                                                     $1
          6      > RETURN                                                   1

Class SourceTransformingLoader:
Function register:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bF4WL
function name:  register
number of ops:  22
compiled vars:  !0 = $filterId, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV_INIT                                        !0      <const ast>
   38     1        ISSET_ISEMPTY_STATIC_PROP                        ~2      'filterId'
          2        BOOL_NOT                                         ~3      ~2
          3      > JMPZ                                                     ~3, ->8
   39     4    >   NEW                                              $4      'RuntimeException'
          5        SEND_VAL_EX                                              'Stream+filter+already+registered'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $4
   42     8    >   INIT_FCALL                                               'stream_filter_register'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'SourceTransformingLoader'
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !1, $6
   43    13        BOOL_NOT                                         ~8      !1
         14      > JMPZ                                                     ~8, ->19
   44    15    >   NEW                                              $9      'RuntimeException'
         16        SEND_VAL_EX                                              'Stream+filter+was+not+registered'
         17        DO_FCALL                                      0          
         18      > THROW                                         0          $9
   46    19    >   ASSIGN_STATIC_PROP                                       'filterId'
         20        OP_DATA                                                  !0
   47    21      > RETURN                                                   null

End of function register

Function filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 5
Branch analysis from position: 13
2 jumps found. (Code = 47) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 35
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 5
Branch analysis from position: 13
Branch analysis from position: 5
filename:       /in/bF4WL
function name:  filter
number of ops:  37
compiled vars:  !0 = $in, !1 = $out, !2 = $consumed, !3 = $closing, !4 = $bucket
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   55     4      > JMP                                                      ->8
   56     5    >   FETCH_OBJ_R                                      ~6      !4, 'data'
          6        ASSIGN_OBJ_OP                                 8          'data'
          7        OP_DATA                                                  ~6
   55     8    >   INIT_FCALL                                               'stream_bucket_make_writeable'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        ASSIGN                                           ~8      !4, $7
         12      > JMPNZ                                                    ~8, ->5
   59    13    > > JMPNZ_EX                                         ~9      !3, ->19
         14    >   INIT_FCALL                                               'feof'
         15        FETCH_OBJ_R                                      ~10     'stream'
         16        SEND_VAL                                                 ~10
         17        DO_ICALL                                         $11     
         18        BOOL                                             ~9      $11
         19    > > JMPZ                                                     ~9, ->35
   60    20    >   FETCH_OBJ_R                                      ~12     'data'
         21        STRLEN                                           ~13     ~12
         22        ASSIGN                                                   !2, ~13
   62    23        INIT_FCALL                                               'stream_bucket_new'
         24        FETCH_OBJ_R                                      ~15     'stream'
         25        SEND_VAL                                                 ~15
         26        FETCH_OBJ_R                                      ~16     'data'
         27        SEND_VAL                                                 ~16
         28        DO_ICALL                                         $17     
         29        ASSIGN                                                   !4, $17
   63    30        INIT_FCALL                                               'stream_bucket_append'
         31        SEND_VAR                                                 !1
         32        SEND_VAR                                                 !4
         33        DO_ICALL                                                 
   65    34      > RETURN                                                   2
   68    35    > > RETURN                                                   1
   69    36*     > RETURN                                                   null

End of function filter

End of class SourceTransformingLoader.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.32 ms | 1392 KiB | 25 Q