3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Source: https://bugs.php.net/bug.php?id=64896 class bad { private $_private = array(); public function __construct() { $this->_private[] = 'oh noes'; } public function __destruct() { //echo "bad::destructor\n"; global $bar; $bar = $this->_private; } } $foo = new stdclass; $foo->foo = $foo; $foo->bad = new bad; print_r($foo); gc_disable(); for ($i=0; $i<9; $i++) { $deep_clone = unserialize(serialize($foo)); gc_collect_cycles(); var_dump($i); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 16
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 16
Branch analysis from position: 31
Branch analysis from position: 16
filename:       /in/vWLK3
function name:  (null)
number of ops:  32
compiled vars:  !0 = $foo, !1 = $i, !2 = $deep_clone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $3      'stdclass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   23     3        ASSIGN_OBJ                                               !0, 'foo'
          4        OP_DATA                                                  !0
   24     5        NEW                                              $8      'bad'
          6        DO_FCALL                                      0          
          7        ASSIGN_OBJ                                               !0, 'bad'
          8        OP_DATA                                                  $8
   25     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   27    12        INIT_FCALL                                               'gc_disable'
         13        DO_ICALL                                                 
   29    14        ASSIGN                                                   !1, 0
         15      > JMP                                                      ->29
   31    16    >   INIT_FCALL                                               'unserialize'
         17        INIT_FCALL                                               'serialize'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $13     
         20        SEND_VAR                                                 $13
         21        DO_ICALL                                         $14     
         22        ASSIGN                                                   !2, $14
   32    23        INIT_FCALL                                               'gc_collect_cycles'
         24        DO_ICALL                                                 
   33    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                                 
   29    28        PRE_INC                                                  !1
         29    >   IS_SMALLER                                               !1, 9
         30      > JMPNZ                                                    ~19, ->16
   34    31    > > RETURN                                                   1

Class bad:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vWLK3
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_W                                      $0      '_private'
          1        ASSIGN_DIM                                               $0
          2        OP_DATA                                                  'oh+noes'
   11     3      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vWLK3
function name:  __destruct
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   BIND_GLOBAL                                              !0, 'bar'
   18     1        FETCH_OBJ_R                                      ~1      '_private'
          2        ASSIGN                                                   !0, ~1
   19     3      > RETURN                                                   null

End of function __destruct

End of class bad.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.33 ms | 1400 KiB | 25 Q