3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); set_error_handler( /** * @throws ErrorException */ static function ($errno, $errstr, $errfile, $errline): void { throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); } ); try { @trigger_error('Oh no'); } catch (ErrorException $good) { assert('Oh no' === $good->getMessage(), get_class($good)); } finally { assert(isset($good), 'an expected exception was not thrown'); } unset($good); var_dump(error_get_last()); try { @trigger_error('Oh no'); } catch (ErrorException $good) { assert('Oh no' === $good->getMessage(), get_class($good)); } finally { assert(isset($good), 'an expected exception was not thrown'); } unset($good); assert(NULL === error_get_last()); try { set_error_handler(null); @trigger_error('Oh no'); restore_error_handler(); try { @trigger_error('Oh no'); } catch (ErrorException $good) { assert('Oh no' === $good->getMessage(), get_class($good)); } finally { assert(isset($good), 'an expected exception was not thrown'); } } catch (ErrorException $fail) { assert(false, sprintf('the "%s" exception must not be thrown', get_class($fail))); } finally { assert(!isset($fail), 'there must not have been any exception'); } var_dump(error_get_last());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 162) Position 1 = 22, Position 2 = 21
Branch analysis from position: 22
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 162) Position 1 = 53, Position 2 = 52
Branch analysis from position: 53
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 95
Branch analysis from position: 95
2 jumps found. (Code = 162) Position 1 = 97, Position 2 = 96
Branch analysis from position: 97
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 96
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
2 jumps found. (Code = 162) Position 1 = 117, Position 2 = 116
Branch analysis from position: 117
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 116
1 jumps found. (Code = 42) Position 1 = 125
Branch analysis from position: 125
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 10
Branch analysis from position: 10
2 jumps found. (Code = 107) Position 1 = 11, Position 2 = -2
Branch analysis from position: 11
2 jumps found. (Code = 162) Position 1 = 22, Position 2 = 21
Branch analysis from position: 22
Branch analysis from position: 21
Found catch point at position: 41
Branch analysis from position: 41
2 jumps found. (Code = 107) Position 1 = 42, Position 2 = -2
Branch analysis from position: 42
2 jumps found. (Code = 162) Position 1 = 53, Position 2 = 52
Branch analysis from position: 53
Branch analysis from position: 52
Found catch point at position: 85
Branch analysis from position: 85
2 jumps found. (Code = 107) Position 1 = 86, Position 2 = -2
Branch analysis from position: 86
2 jumps found. (Code = 162) Position 1 = 97, Position 2 = 96
Branch analysis from position: 97
Branch analysis from position: 96
Found catch point at position: 105
Branch analysis from position: 105
2 jumps found. (Code = 107) Position 1 = 106, Position 2 = -2
Branch analysis from position: 106
2 jumps found. (Code = 162) Position 1 = 117, Position 2 = 116
Branch analysis from position: 117
Branch analysis from position: 116
filename:       /in/8fopq
function name:  (null)
number of ops:  131
compiled vars:  !0 = $good, !1 = $fail
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'set_error_handler'
    7     1        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
    9     2        SEND_VAL                                                     ~2
    3     3        DO_ICALL                                                     
   13     4        BEGIN_SILENCE                                        ~5      
          5        INIT_FCALL                                                   'trigger_error'
          6        SEND_VAL                                                     'Oh+no'
          7        DO_ICALL                                                     
          8        END_SILENCE                                                  ~5
          9      > JMP                                                          ->20
   14    10  E > > CATCH                                           last         'ErrorException'
   15    11    >   ASSERT_CHECK                                                 
         12        INIT_FCALL                                                   'assert'
         13        INIT_METHOD_CALL                                             !0, 'getMessage'
         14        DO_FCALL                                          0  $7      
         15        IS_IDENTICAL                                         ~8      $7, 'Oh+no'
         16        SEND_VAL                                                     ~8
         17        GET_CLASS                                            ~9      !0
         18        SEND_VAL                                                     ~9
         19        DO_ICALL                                                     
   16    20    > > FAST_CALL                                                    ->22
         21    > > JMP                                                          ->29
   17    22    >   ASSERT_CHECK                                                 
         23        INIT_FCALL                                                   'assert'
         24        ISSET_ISEMPTY_CV                                     ~11     !0
         25        SEND_VAL                                                     ~11
         26        SEND_VAL                                                     'an+expected+exception+was+not+thrown'
         27        DO_ICALL                                                     
         28      > FAST_RET                                                     
   19    29    >   UNSET_CV                                                     !0
   21    30        INIT_FCALL                                                   'var_dump'
         31        INIT_FCALL                                                   'error_get_last'
         32        DO_ICALL                                             $13     
         33        SEND_VAR                                                     $13
         34        DO_ICALL                                                     
   24    35        BEGIN_SILENCE                                        ~16     
         36        INIT_FCALL                                                   'trigger_error'
         37        SEND_VAL                                                     'Oh+no'
         38        DO_ICALL                                                     
         39        END_SILENCE                                                  ~16
         40      > JMP                                                          ->51
   25    41  E > > CATCH                                           last         'ErrorException'
   26    42    >   ASSERT_CHECK                                                 
         43        INIT_FCALL                                                   'assert'
         44        INIT_METHOD_CALL                                             !0, 'getMessage'
         45        DO_FCALL                                          0  $18     
         46        IS_IDENTICAL                                         ~19     $18, 'Oh+no'
         47        SEND_VAL                                                     ~19
         48        GET_CLASS                                            ~20     !0
         49        SEND_VAL                                                     ~20
         50        DO_ICALL                                                     
   27    51    > > FAST_CALL                                                    ->53
         52    > > JMP                                                          ->60
   28    53    >   ASSERT_CHECK                                                 
         54        INIT_FCALL                                                   'assert'
         55        ISSET_ISEMPTY_CV                                     ~22     !0
         56        SEND_VAL                                                     ~22
         57        SEND_VAL                                                     'an+expected+exception+was+not+thrown'
         58        DO_ICALL                                                     
         59      > FAST_RET                                                     
   30    60    >   UNSET_CV                                                     !0
   31    61        ASSERT_CHECK                                                 
         62        INIT_FCALL                                                   'assert'
         63        INIT_FCALL                                                   'error_get_last'
         64        DO_ICALL                                             $24     
         65        TYPE_CHECK                                        2  ~25     $24
         66        SEND_VAL                                                     ~25
         67        SEND_VAL                                                     'assert%28NULL+%3D%3D%3D+error_get_last%28%29%29'
         68        DO_ICALL                                                     
   34    69        INIT_FCALL                                                   'set_error_handler'
         70        SEND_VAL                                                     null
         71        DO_ICALL                                                     
   35    72        BEGIN_SILENCE                                        ~29     
         73        INIT_FCALL                                                   'trigger_error'
         74        SEND_VAL                                                     'Oh+no'
         75        DO_ICALL                                                     
         76        END_SILENCE                                                  ~29
   36    77        INIT_FCALL                                                   'restore_error_handler'
         78        DO_ICALL                                                     
   38    79        BEGIN_SILENCE                                        ~33     
         80        INIT_FCALL                                                   'trigger_error'
         81        SEND_VAL                                                     'Oh+no'
         82        DO_ICALL                                                     
         83        END_SILENCE                                                  ~33
         84      > JMP                                                          ->95
   39    85  E > > CATCH                                           last         'ErrorException'
   40    86    >   ASSERT_CHECK                                                 
         87        INIT_FCALL                                                   'assert'
         88        INIT_METHOD_CALL                                             !0, 'getMessage'
         89        DO_FCALL                                          0  $35     
         90        IS_IDENTICAL                                         ~36     $35, 'Oh+no'
         91        SEND_VAL                                                     ~36
         92        GET_CLASS                                            ~37     !0
         93        SEND_VAL                                                     ~37
         94        DO_ICALL                                                     
   41    95    > > FAST_CALL                                                    ->97
         96    > > JMP                                                          ->104
   42    97    >   ASSERT_CHECK                                                 
         98        INIT_FCALL                                                   'assert'
         99        ISSET_ISEMPTY_CV                                     ~39     !0
        100        SEND_VAL                                                     ~39
        101        SEND_VAL                                                     'an+expected+exception+was+not+thrown'
        102        DO_ICALL                                                     
        103      > FAST_RET                                                     
        104    > > JMP                                                          ->115
   44   105  E > > CATCH                                           last         'ErrorException'
   45   106    >   ASSERT_CHECK                                                 
        107        INIT_FCALL                                                   'assert'
        108        SEND_VAL                                                     <false>
        109        GET_CLASS                                            ~41     !1
        110        ROPE_INIT                                         3  ~43     'the+%22'
        111        ROPE_ADD                                          1  ~43     ~43, ~41
        112        ROPE_END                                          2  ~42     ~43, '%22+exception+must+not+be+thrown'
        113        SEND_VAL                                                     ~42
        114        DO_ICALL                                                     
   46   115    > > FAST_CALL                                                    ->117
        116    > > JMP                                                          ->125
   47   117    >   ASSERT_CHECK                                                 
        118        INIT_FCALL                                                   'assert'
        119        ISSET_ISEMPTY_CV                                     ~46     !1
        120        BOOL_NOT                                             ~47     ~46
        121        SEND_VAL                                                     ~47
        122        SEND_VAL                                                     'there+must+not+have+been+any+exception'
        123        DO_ICALL                                                     
        124      > FAST_RET                                                     
   50   125    >   INIT_FCALL                                                   'var_dump'
        126        INIT_FCALL                                                   'error_get_last'
        127        DO_ICALL                                             $49     
        128        SEND_VAR                                                     $49
        129        DO_ICALL                                                     
        130      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/8fopq
function name:  {closure:/in/8fopq:7}
number of ops:  13
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV                                                 !3      
    8     4        NEW                                                  $4      'ErrorException'
          5        SEND_VAR_EX                                                  !1
          6        SEND_VAR_EX                                                  !0
          7        SEND_VAR_EX                                                  !0
          8        SEND_VAR_EX                                                  !2
          9        SEND_VAR_EX                                                  !3
         10        DO_FCALL                                          0          
         11      > THROW                                             0          $4
    9    12*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.98 ms | 2059 KiB | 19 Q