3v4l.org

run code in 500+ PHP versions simultaneously
<?php /** * noop filter class for demonstration */ class stream_sigsegv extends php_user_filter { /** * @var resource */ private $filterHandle; /** * @param resource $filterHandle */ public function __construct($filterHandle) { $this->filterHandle = $filterHandle; } /** * @return int */ public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; } public function __destruct() { if (is_resource($this->filterHandle)) { stream_filter_remove($this->filterHandle); } } } $filterName = $filterClass = 'stream_sigsegv'; stream_filter_register($filterName, $filterClass); $handle = fopen('php://temp', 'rb'); $filterHandle = stream_filter_append($handle, $filterName, STREAM_FILTER_READ); assert(false !== $filterHandle, 'append filter success'); $foo = new stream_sigsegv($filterHandle); fclose($handle); # Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QR6ev
function name:  (null)
number of ops:  31
compiled vars:  !0 = $filterName, !1 = $filterClass, !2 = $handle, !3 = $filterHandle, !4 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   41     0  E >   ASSIGN                                               ~5      !1, 'stream_sigsegv'
          1        ASSIGN                                                       !0, ~5
   43     2        INIT_FCALL                                                   'stream_filter_register'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                                     
   45     6        INIT_FCALL                                                   'fopen'
          7        SEND_VAL                                                     'php%3A%2F%2Ftemp'
          8        SEND_VAL                                                     'rb'
          9        DO_ICALL                                             $8      
         10        ASSIGN                                                       !2, $8
   47    11        INIT_FCALL                                                   'stream_filter_append'
         12        SEND_VAR                                                     !2
         13        SEND_VAR                                                     !0
         14        SEND_VAL                                                     1
         15        DO_ICALL                                             $10     
         16        ASSIGN                                                       !3, $10
   49    17        ASSERT_CHECK                                                 
         18        INIT_FCALL                                                   'assert'
         19        TYPE_CHECK                                      1018  ~12     !3
         20        SEND_VAL                                                     ~12
         21        SEND_VAL                                                     'append+filter+success'
         22        DO_ICALL                                                     
   51    23        NEW                                                  $14     'stream_sigsegv'
         24        SEND_VAR_EX                                                  !3
         25        DO_FCALL                                          0          
         26        ASSIGN                                                       !4, $14
   53    27        INIT_FCALL                                                   'fclose'
         28        SEND_VAR                                                     !2
         29        DO_ICALL                                                     
   55    30      > RETURN                                                       1

Class stream_sigsegv:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QR6ev
function name:  __construct
number of ops:  4
compiled vars:  !0 = $filterHandle
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
   18     1        ASSIGN_OBJ                                                   'filterHandle'
          2        OP_DATA                                                      !0
   19     3      > RETURN                                                       null

End of function __construct

Function filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
Branch analysis from position: 5
filename:       /in/QR6ev
function name:  filter
number of ops:  18
compiled vars:  !0 = $in, !1 = $out, !2 = $consumed, !3 = $closing, !4 = $bucket
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV                                                 !3      
   26     4      > JMP                                                          ->11
   27     5    >   FETCH_OBJ_R                                          ~5      !4, 'datalen'
          6        ASSIGN_OP                                         1          !2, ~5
   28     7        INIT_FCALL                                                   'stream_bucket_append'
          8        SEND_VAR                                                     !1
          9        SEND_VAR                                                     !4
         10        DO_ICALL                                                     
   26    11    >   INIT_FCALL                                                   'stream_bucket_make_writeable'
         12        SEND_VAR                                                     !0
         13        DO_ICALL                                             $8      
         14        ASSIGN                                               ~9      !4, $8
         15      > JMPNZ                                                        ~9, ->5
   30    16    > > RETURN                                                       2
   31    17*     > RETURN                                                       null

End of function filter

Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/QR6ev
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   FETCH_OBJ_R                                          ~0      'filterHandle'
          1        TYPE_CHECK                                      512          ~0
          2      > JMPZ                                                         ~1, ->7
   36     3    >   INIT_FCALL                                                   'stream_filter_remove'
          4        FETCH_OBJ_R                                          ~2      'filterHandle'
          5        SEND_VAL                                                     ~2
          6        DO_ICALL                                                     
   38     7    > > RETURN                                                       null

End of function __destruct

End of class stream_sigsegv.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
233.6 ms | 2154 KiB | 21 Q