3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*set_exception_handler(function ($e) { var_dump($e->getMessage()); throw 1; });*/ function unhandled(Exception $e) { // set dummy handler and return previous handler $handler = set_exception_handler(function ($e) { var_dump($e); throw 1; }); // use dummy handler when no original handler is available if ($handler === null) { $handler = set_exception_handler(null); } set_exception_handler(null); try { $handler($e); } catch (Exception $e) { var_dump('foo', $e); } echo 'die'; die(255); } echo 1; unhandled(new RuntimeException('fatal error')); echo 2;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ktOfm
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   ECHO                                                     1
   33     1        INIT_FCALL                                               'unhandled'
          2        NEW                                              $0      'RuntimeException'
          3        SEND_VAL_EX                                              'fatal+error'
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $0
          6        DO_FCALL                                      0          
   34     7        ECHO                                                     2
   35     8      > RETURN                                                   1

Function unhandled:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 12
Found catch point at position: 19
Branch analysis from position: 19
2 jumps found. (Code = 107) Position 1 = 20, Position 2 = -2
Branch analysis from position: 20
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/ktOfm
function name:  unhandled
number of ops:  27
compiled vars:  !0 = $e, !1 = $handler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'set_exception_handler'
          2        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   14     3        SEND_VAL                                                 ~2
   11     4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   17     6        TYPE_CHECK                                    2          !1
          7      > JMPZ                                                     ~5, ->12
   18     8    >   INIT_FCALL                                               'set_exception_handler'
          9        SEND_VAL                                                 null
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !1, $6
   21    12    >   INIT_FCALL                                               'set_exception_handler'
         13        SEND_VAL                                                 null
         14        DO_ICALL                                                 
   24    15        INIT_DYNAMIC_CALL                                        !1
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0          
         18      > JMP                                                      ->24
   25    19  E > > CATCH                                       last         'Exception'
   26    20    >   INIT_FCALL                                               'var_dump'
         21        SEND_VAL                                                 'foo'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
   28    24    >   ECHO                                                     'die'
   29    25      > EXIT                                                     255
   30    26*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/ktOfm
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   13     4      > THROW                                         0          1
   14     5*     > RETURN                                                   null

End of Dynamic Function 0

End of function unhandled

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.68 ms | 1006 KiB | 16 Q