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; true; $i++) { //$deep_clone = unserialize(serialize($foo)); $deep_clonde = clone $foo; gc_collect_cycles(); var_dump($i); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 16
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 16
Branch analysis from position: 25
Branch analysis from position: 16
filename:       /in/p1ECW
function name:  (null)
number of ops:  26
compiled vars:  !0 = $foo, !1 = $i, !2 = $deep_clonde
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                                                      ->24
   32    16    >   CLONE                                            ~13     !0
         17        ASSIGN                                                   !2, ~13
   33    18        INIT_FCALL                                               'gc_collect_cycles'
         19        DO_ICALL                                                 
   34    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
   29    23        PRE_INC                                                  !1
         24    > > JMPNZ                                                    <true>, ->16
   35    25    > > RETURN                                                   1

Class bad:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p1ECW
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/p1ECW
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:
151.66 ms | 1400 KiB | 21 Q