3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public $foo; public function __wakeup() { echo 'In foo', PHP_EOL, PHP_EOL; $this->foo = null; } public function __destruct() { echo 'Destruct foo', PHP_EOL, PHP_EOL; } } class Bar { public $bar; public function __wakeup() { echo 'In bar', PHP_EOL, PHP_EOL; $this->bar = null; } public function __destruct() { echo 'Destruct bar', PHP_EOL, PHP_EOL; throw new \Exception('x'); } } $f = new Foo; $b = new Bar; $f->foo = $b; $b->bar = $f; try { var_dump(unserialize(serialize([$f]))); } catch (\Throwable $e) { echo $e, PHP_EOL, PHP_EOL; } echo "==========", PHP_EOL, PHP_EOL; try { var_dump(unserialize(serialize([$f, $b]))); } catch (\Throwable $e) { echo $e, PHP_EOL, PHP_EOL; } echo "==========", PHP_EOL, PHP_EOL; try { var_dump(unserialize(serialize([$b, $f]))); } catch (\Throwable $e) { echo $e, PHP_EOL, PHP_EOL; } echo "==========", PHP_EOL, PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 21
Branch analysis from position: 21
2 jumps found. (Code = 107) Position 1 = 22, Position 2 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Found catch point at position: 40
Branch analysis from position: 40
2 jumps found. (Code = 107) Position 1 = 41, Position 2 = -2
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
Found catch point at position: 59
Branch analysis from position: 59
2 jumps found. (Code = 107) Position 1 = 60, Position 2 = -2
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tnh2R
function name:  (null)
number of ops:  67
compiled vars:  !0 = $f, !1 = $b, !2 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   NEW                                                  $3      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   31     3        NEW                                                  $6      'Bar'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $6
   32     6        ASSIGN_OBJ                                                   !0, 'foo'
          7        OP_DATA                                                      !1
   33     8        ASSIGN_OBJ                                                   !1, 'bar'
          9        OP_DATA                                                      !0
   36    10        INIT_FCALL                                                   'var_dump'
         11        INIT_FCALL                                                   'unserialize'
         12        INIT_FCALL                                                   'serialize'
         13        INIT_ARRAY                                           ~11     !0
         14        SEND_VAL                                                     ~11
         15        DO_ICALL                                             $12     
         16        SEND_VAR                                                     $12
         17        DO_ICALL                                             $13     
         18        SEND_VAR                                                     $13
         19        DO_ICALL                                                     
         20      > JMP                                                          ->25
   37    21  E > > CATCH                                           last         'Throwable'
   38    22    >   ECHO                                                         !2
         23        ECHO                                                         '%0A'
         24        ECHO                                                         '%0A'
   40    25    >   ECHO                                                         '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D'
         26        ECHO                                                         '%0A'
         27        ECHO                                                         '%0A'
   43    28        INIT_FCALL                                                   'var_dump'
         29        INIT_FCALL                                                   'unserialize'
         30        INIT_FCALL                                                   'serialize'
         31        INIT_ARRAY                                           ~15     !0
         32        ADD_ARRAY_ELEMENT                                    ~15     !1
         33        SEND_VAL                                                     ~15
         34        DO_ICALL                                             $16     
         35        SEND_VAR                                                     $16
         36        DO_ICALL                                             $17     
         37        SEND_VAR                                                     $17
         38        DO_ICALL                                                     
         39      > JMP                                                          ->44
   44    40  E > > CATCH                                           last         'Throwable'
   45    41    >   ECHO                                                         !2
         42        ECHO                                                         '%0A'
         43        ECHO                                                         '%0A'
   47    44    >   ECHO                                                         '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D'
         45        ECHO                                                         '%0A'
         46        ECHO                                                         '%0A'
   49    47        INIT_FCALL                                                   'var_dump'
         48        INIT_FCALL                                                   'unserialize'
         49        INIT_FCALL                                                   'serialize'
         50        INIT_ARRAY                                           ~19     !1
         51        ADD_ARRAY_ELEMENT                                    ~19     !0
         52        SEND_VAL                                                     ~19
         53        DO_ICALL                                             $20     
         54        SEND_VAR                                                     $20
         55        DO_ICALL                                             $21     
         56        SEND_VAR                                                     $21
         57        DO_ICALL                                                     
         58      > JMP                                                          ->63
   50    59  E > > CATCH                                           last         'Throwable'
   51    60    >   ECHO                                                         !2
         61        ECHO                                                         '%0A'
         62        ECHO                                                         '%0A'
   53    63    >   ECHO                                                         '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D'
         64        ECHO                                                         '%0A'
         65        ECHO                                                         '%0A'
   54    66      > RETURN                                                       1

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

End of function __wakeup

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tnh2R
function name:  __destruct
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                         'Destruct+foo'
          1        ECHO                                                         '%0A'
          2        ECHO                                                         '%0A'
   13     3      > 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 = 62) Position 1 = -2
filename:       /in/tnh2R
function name:  __wakeup
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   ECHO                                                         'In+bar'
          1        ECHO                                                         '%0A'
          2        ECHO                                                         '%0A'
   21     3        ASSIGN_OBJ                                                   'bar'
          4        OP_DATA                                                      null
   22     5      > 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/tnh2R
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   ECHO                                                         'Destruct+bar'
          1        ECHO                                                         '%0A'
          2        ECHO                                                         '%0A'
   26     3        NEW                                                  $0      'Exception'
          4        SEND_VAL_EX                                                  'x'
          5        DO_FCALL                                          0          
          6      > THROW                                             0          $0
   27     7*     > RETURN                                                       null

End of function __destruct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.28 ms | 3680 KiB | 16 Q