3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __wakeup() { echo 'In foo', PHP_EOL, PHP_EOL; throw new \Exception('Foo'); } public function __destruct() { echo 'Destruct foo', PHP_EOL, PHP_EOL; throw new \Exception('Foo destruct'); } } class Bar { public function __wakeup() { echo 'In bar', PHP_EOL, PHP_EOL; throw new \Exception('Bar'); } public function __destruct() { echo 'Destruct bar', PHP_EOL, PHP_EOL; throw new \Exception('Bar destruct'); } } try { unserialize(serialize([$f = new Foo, $b = new Bar])); } catch (\Throwable $e) { echo $e, PHP_EOL, PHP_EOL; } echo "==========", PHP_EOL, PHP_EOL; try { unserialize(serialize([$b, $f])); } catch (\Throwable $e) { echo $e, PHP_EOL, PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 15
Branch analysis from position: 15
2 jumps found. (Code = 107) Position 1 = 16, Position 2 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Found catch point at position: 31
Branch analysis from position: 31
2 jumps found. (Code = 107) Position 1 = 32, Position 2 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/82UJj
function name:  (null)
number of ops:  36
compiled vars:  !0 = $f, !1 = $b, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'unserialize'
          1        INIT_FCALL                                               'serialize'
          2        NEW                                              $3      'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                           ~5      !0, $3
          5        INIT_ARRAY                                       ~6      ~5
          6        NEW                                              $7      'Bar'
          7        DO_FCALL                                      0          
          8        ASSIGN                                           ~9      !1, $7
          9        ADD_ARRAY_ELEMENT                                ~6      ~9
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $10     
         12        SEND_VAR                                                 $10
         13        DO_ICALL                                                 
         14      > JMP                                                      ->19
   29    15  E > > CATCH                                       last         'Throwable'
   30    16    >   ECHO                                                     !2
         17        ECHO                                                     '%0A'
         18        ECHO                                                     '%0A'
   33    19    >   ECHO                                                     '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D'
         20        ECHO                                                     '%0A'
         21        ECHO                                                     '%0A'
   36    22        INIT_FCALL                                               'unserialize'
         23        INIT_FCALL                                               'serialize'
         24        INIT_ARRAY                                       ~12     !1
         25        ADD_ARRAY_ELEMENT                                ~12     !0
         26        SEND_VAL                                                 ~12
         27        DO_ICALL                                         $13     
         28        SEND_VAR                                                 $13
         29        DO_ICALL                                                 
         30      > JMP                                                      ->35
   37    31  E > > CATCH                                       last         'Throwable'
   38    32    >   ECHO                                                     !2
         33        ECHO                                                     '%0A'
         34        ECHO                                                     '%0A'
   39    35    > > RETURN                                                   1

Class Foo:
Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/82UJj
function name:  __wakeup
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'In+foo'
          1        ECHO                                                     '%0A'
          2        ECHO                                                     '%0A'
    6     3        NEW                                              $0      'Exception'
          4        SEND_VAL_EX                                              'Foo'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $0
    7     7*     > RETURN                                                   null

End of function __wakeup

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/82UJj
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'Destruct+foo'
          1        ECHO                                                     '%0A'
          2        ECHO                                                     '%0A'
   11     3        NEW                                              $0      'Exception'
          4        SEND_VAL_EX                                              'Foo+destruct'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $0
   12     7*     > RETURN                                                   null

End of function __destruct

End of class Foo.

Class Bar:
Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/82UJj
function name:  __wakeup
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ECHO                                                     'In+bar'
          1        ECHO                                                     '%0A'
          2        ECHO                                                     '%0A'
   18     3        NEW                                              $0      'Exception'
          4        SEND_VAL_EX                                              'Bar'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $0
   19     7*     > RETURN                                                   null

End of function __wakeup

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/82UJj
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ECHO                                                     'Destruct+bar'
          1        ECHO                                                     '%0A'
          2        ECHO                                                     '%0A'
   23     3        NEW                                              $0      'Exception'
          4        SEND_VAL_EX                                              'Bar+destruct'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $0
   24     7*     > RETURN                                                   null

End of function __destruct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.44 ms | 1408 KiB | 17 Q