3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace Foo; class StreamHandler { public $errorMessage; public function __construct() { $this->errorMessage = null; set_error_handler([$this, 'customErrorHandler']); $stream = fopen('c:/fososdfsdfsd', 'a'); restore_error_handler(); } private function customErrorHandler(int $code, string $msg): bool { $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg); return true; } } function fopen() { throw new \Exception(); } try{ $f = new StreamHandler; var_dump($f->errorMessage); }catch (\Throwable){ } $a = []; var_dump($a[1]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 9
Branch analysis from position: 9
2 jumps found. (Code = 107) Position 1 = 10, Position 2 = -2
Branch analysis from position: 10
filename:       /in/e3L7U
function name:  (null)
number of ops:  17
compiled vars:  !0 = $f, !1 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   NEW                                                  $2      'Foo%5CStreamHandler'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   31     3        INIT_NS_FCALL_BY_NAME                                        'Foo%5Cvar_dump'
          4        CHECK_FUNC_ARG                                               
          5        FETCH_OBJ_FUNC_ARG                                   $5      !0, 'errorMessage'
          6        SEND_FUNC_ARG                                                $5
          7        DO_FCALL                                          0          
          8      > JMP                                                          ->10
   32     9  E > > CATCH                                           last         'Throwable'
   36    10    >   ASSIGN                                                       !1, <array>
   37    11        INIT_NS_FCALL_BY_NAME                                        'Foo%5Cvar_dump'
         12        CHECK_FUNC_ARG                                               
         13        FETCH_DIM_FUNC_ARG                                   $8      !1, 1
         14        SEND_FUNC_ARG                                                $8
         15        DO_FCALL                                          0          
         16      > RETURN                                                       1

Function foo%5Cfopen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/e3L7U
function name:  Foo\fopen
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   NEW                                                  $0      'Exception'
          1        DO_FCALL                                          0          
          2      > THROW                                             0          $0
   27     3*     > RETURN                                                       null

End of function foo%5Cfopen

Class Foo\StreamHandler:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e3L7U
function name:  __construct
number of ops:  16
compiled vars:  !0 = $stream
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   ASSIGN_OBJ                                                   'errorMessage'
          1        OP_DATA                                                      null
   11     2        INIT_NS_FCALL_BY_NAME                                        'Foo%5Cset_error_handler'
          3        FETCH_THIS                                           ~2      
          4        INIT_ARRAY                                           ~3      ~2
          5        ADD_ARRAY_ELEMENT                                    ~3      'customErrorHandler'
          6        SEND_VAL_EX                                                  ~3
          7        DO_FCALL                                          0          
   12     8        INIT_NS_FCALL_BY_NAME                                        'Foo%5Cfopen'
          9        SEND_VAL_EX                                                  'c%3A%2Ffososdfsdfsd'
         10        SEND_VAL_EX                                                  'a'
         11        DO_FCALL                                          0  $5      
         12        ASSIGN                                                       !0, $5
   13    13        INIT_NS_FCALL_BY_NAME                                        'Foo%5Crestore_error_handler'
         14        DO_FCALL                                          0          
   14    15      > RETURN                                                       null

End of function __construct

Function customerrorhandler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 208) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e3L7U
function name:  customErrorHandler
number of ops:  16
compiled vars:  !0 = $code, !1 = $msg
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   18     2      > JMP_FRAMELESS                                   s32          'foo%5Cpreg_replace', ->9
          3    >   INIT_NS_FCALL_BY_NAME                                        'Foo%5Cpreg_replace'
          4        SEND_VAL_EX                                                  '%7B%5E%28fopen%7Cmkdir%29%5C%28.%2A%3F%5C%29%3A+%7D'
          5        SEND_VAL_EX                                                  ''
          6        SEND_VAR_EX                                                  !1
          7        DO_FCALL                                          0  $3      
          8      > JMP                                                          ->11
          9    >   FRAMELESS_ICALL_3                preg_replace        $3      '%7B%5E%28fopen%7Cmkdir%29%5C%28.%2A%3F%5C%29%3A+%7D', ''
         10        OP_DATA                                                      !1
         11    >   ASSIGN_OBJ                                                   'errorMessage'
         12        OP_DATA                                                      $3
   20    13      > RETURN                                                       <true>
   21    14*       VERIFY_RETURN_TYPE                                           
         15*     > RETURN                                                       null

End of function customerrorhandler

End of class Foo\StreamHandler.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.76 ms | 1809 KiB | 18 Q