3v4l.org

run code in 500+ PHP versions simultaneously
<?php 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; } } $f = new StreamHandler; var_dump($f->errorMessage);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NOrFI
function name:  (null)
number of ops:  8
compiled vars:  !0 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   NEW                                                  $1      'StreamHandler'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   23     3        INIT_FCALL                                                   'var_dump'
          4        FETCH_OBJ_R                                          ~4      !0, 'errorMessage'
          5        SEND_VAL                                                     ~4
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

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

End of function __construct

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

End of function customerrorhandler

End of class StreamHandler.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
175.93 ms | 3388 KiB | 19 Q