3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { private function customErrorHandler(int $code, string $msg): bool { var_dump(preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg)); return true; } protected function write(): void { set_error_handler([$this, 'customErrorHandler']); try { $stream = fopen('php://memory', 'a'); trigger_error('Test test'); } finally { restore_error_handler(); } } public function test() { $this->write(); } } class Bar extends Foo { public function test2() { $this->write(); } } (new Foo)->test(); (new Bar)->test2();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHA87
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   NEW                                                  $0      'Foo'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'test'
          3        DO_FCALL                                          0          
   36     4        NEW                                                  $3      'Bar'
          5        DO_FCALL                                          0          
          6        INIT_METHOD_CALL                                             $3, 'test2'
          7        DO_FCALL                                          0          
          8      > RETURN                                                       1

Class Foo:
Function customerrorhandler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHA87
function name:  customErrorHandler
number of ops:  10
compiled vars:  !0 = $code, !1 = $msg
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    6     2        INIT_FCALL                                                   'var_dump'
          3        FRAMELESS_ICALL_3                preg_replace        ~2      '%7B%5E%28fopen%7Cmkdir%29%5C%28.%2A%3F%5C%29%3A+%7D', ''
          4        OP_DATA                                                      !1
          5        SEND_VAL                                                     ~2
          6        DO_ICALL                                                     
    8     7      > RETURN                                                       <true>
    9     8*       VERIFY_RETURN_TYPE                                           
          9*     > RETURN                                                       null

End of function customerrorhandler

Function write:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 162) Position 1 = 16, Position 2 = 15
Branch analysis from position: 16
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHA87
function name:  write
number of ops:  20
compiled vars:  !0 = $stream
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                                   'set_error_handler'
          1        FETCH_THIS                                           ~1      
          2        INIT_ARRAY                                           ~2      ~1
          3        ADD_ARRAY_ELEMENT                                    ~2      'customErrorHandler'
          4        SEND_VAL                                                     ~2
          5        DO_ICALL                                                     
   15     6        INIT_FCALL                                                   'fopen'
          7        SEND_VAL                                                     'php%3A%2F%2Fmemory'
          8        SEND_VAL                                                     'a'
          9        DO_ICALL                                             $5      
         10        ASSIGN                                                       !0, $5
   16    11        INIT_FCALL                                                   'trigger_error'
         12        SEND_VAL                                                     'Test+test'
         13        DO_ICALL                                                     
   17    14      > FAST_CALL                                                    ->16
         15    > > JMP                                                          ->19
   18    16    >   INIT_FCALL                                                   'restore_error_handler'
         17        DO_ICALL                                                     
         18      > FAST_RET                                                     
   20    19    > > RETURN                                                       null

End of function write

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHA87
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   INIT_METHOD_CALL                                             'write'
          1        DO_FCALL                                          0          
   25     2      > RETURN                                                       null

End of function test

End of class Foo.

Class Bar:
Function test2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHA87
function name:  test2
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   INIT_METHOD_CALL                                             'write'
          1        DO_FCALL                                          0          
   32     2      > RETURN                                                       null

End of function test2

Function customerrorhandler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHA87
function name:  customErrorHandler
number of ops:  10
compiled vars:  !0 = $code, !1 = $msg
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    6     2        INIT_FCALL                                                   'var_dump'
          3        FRAMELESS_ICALL_3                preg_replace        ~2      '%7B%5E%28fopen%7Cmkdir%29%5C%28.%2A%3F%5C%29%3A+%7D', ''
          4        OP_DATA                                                      !1
          5        SEND_VAL                                                     ~2
          6        DO_ICALL                                                     
    8     7      > RETURN                                                       <true>
    9     8*       VERIFY_RETURN_TYPE                                           
          9*     > RETURN                                                       null

End of function customerrorhandler

Function write:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 162) Position 1 = 16, Position 2 = 15
Branch analysis from position: 16
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHA87
function name:  write
number of ops:  20
compiled vars:  !0 = $stream
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                                   'set_error_handler'
          1        FETCH_THIS                                           ~1      
          2        INIT_ARRAY                                           ~2      ~1
          3        ADD_ARRAY_ELEMENT                                    ~2      'customErrorHandler'
          4        SEND_VAL                                                     ~2
          5        DO_ICALL                                                     
   15     6        INIT_FCALL                                                   'fopen'
          7        SEND_VAL                                                     'php%3A%2F%2Fmemory'
          8        SEND_VAL                                                     'a'
          9        DO_ICALL                                             $5      
         10        ASSIGN                                                       !0, $5
   16    11        INIT_FCALL                                                   'trigger_error'
         12        SEND_VAL                                                     'Test+test'
         13        DO_ICALL                                                     
   17    14      > FAST_CALL                                                    ->16
         15    > > JMP                                                          ->19
   18    16    >   INIT_FCALL                                                   'restore_error_handler'
         17        DO_ICALL                                                     
         18      > FAST_RET                                                     
   20    19    > > RETURN                                                       null

End of function write

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZHA87
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   INIT_METHOD_CALL                                             'write'
          1        DO_FCALL                                          0          
   25     2      > RETURN                                                       null

End of function test

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.2 ms | 1604 KiB | 20 Q