3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL|E_STRICT); class Obj { // Testing $this->a being a dynamic property. function __construct($a) { $this->a = $a; } public function __wakeup() { $this->a = 42; for ($i = 0; $i < 10000; $i++) { $this->{'b' . $i} = 42; } } } function main() { $obj = (object)["test" => 'foo']; // array (not a reference, but should be copied on write) $a = new Obj($obj); $b = new Obj($obj); $variable = [$a, $b]; $serialized = serialize($variable); printf("%s\n", $serialized); $unserialized = unserialize($serialized); echo "Called __unserialize\n"; for ($i = 0; $i < 10000; $i++) { if ($unserialized[0]->{'b' . $i} !== 42) { echo "Fail 0 b$i\n"; return; } if ($unserialized[1]->{'b' . $i} !== 42) { echo "Fail 1 b$i\n"; return; } unset($unserialized[0]->{'b' . $i}); unset($unserialized[1]->{'b' . $i}); } var_dump($unserialized); } main();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1SsOJ
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   44     3        INIT_FCALL                                               'main'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function main:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 28
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 38
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 48
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 28
Branch analysis from position: 57
Branch analysis from position: 28
filename:       /in/1SsOJ
function name:  main
number of ops:  61
compiled vars:  !0 = $obj, !1 = $a, !2 = $b, !3 = $variable, !4 = $serialized, !5 = $unserialized, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   CAST                                          8  ~7      <array>
          1        ASSIGN                                                   !0, ~7
   23     2        NEW                                              $9      'Obj'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $9
   24     6        NEW                                              $12     'Obj'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $12
   25    10        INIT_ARRAY                                       ~15     !1
         11        ADD_ARRAY_ELEMENT                                ~15     !2
         12        ASSIGN                                                   !3, ~15
   26    13        INIT_FCALL                                               'serialize'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $17     
         16        ASSIGN                                                   !4, $17
   27    17        INIT_FCALL                                               'printf'
         18        SEND_VAL                                                 '%25s%0A'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
   28    21        INIT_FCALL                                               'unserialize'
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $20     
         24        ASSIGN                                                   !5, $20
   29    25        ECHO                                                     'Called+__unserialize%0A'
   30    26        ASSIGN                                                   !6, 0
         27      > JMP                                                      ->55
   31    28    >   CONCAT                                           ~24     'b', !6
         29        FETCH_DIM_R                                      ~23     !5, 0
         30        FETCH_OBJ_R                                      ~25     ~23, ~24
         31        IS_NOT_IDENTICAL                                         ~25, 42
         32      > JMPZ                                                     ~26, ->38
   32    33    >   ROPE_INIT                                     3  ~28     'Fail+0+b'
         34        ROPE_ADD                                      1  ~28     ~28, !6
         35        ROPE_END                                      2  ~27     ~28, '%0A'
         36        ECHO                                                     ~27
   33    37      > RETURN                                                   null
   35    38    >   CONCAT                                           ~31     'b', !6
         39        FETCH_DIM_R                                      ~30     !5, 1
         40        FETCH_OBJ_R                                      ~32     ~30, ~31
         41        IS_NOT_IDENTICAL                                         ~32, 42
         42      > JMPZ                                                     ~33, ->48
   36    43    >   ROPE_INIT                                     3  ~35     'Fail+1+b'
         44        ROPE_ADD                                      1  ~35     ~35, !6
         45        ROPE_END                                      2  ~34     ~35, '%0A'
         46        ECHO                                                     ~34
   37    47      > RETURN                                                   null
   39    48    >   CONCAT                                           ~38     'b', !6
         49        FETCH_DIM_UNSET                                  $37     !5, 0
         50        UNSET_OBJ                                                $37, ~38
   40    51        CONCAT                                           ~40     'b', !6
         52        FETCH_DIM_UNSET                                  $39     !5, 1
         53        UNSET_OBJ                                                $39, ~40
   30    54        PRE_INC                                                  !6
         55    >   IS_SMALLER                                               !6, 10000
         56      > JMPNZ                                                    ~42, ->28
   42    57    >   INIT_FCALL                                               'var_dump'
         58        SEND_VAR                                                 !5
         59        DO_ICALL                                                 
   43    60      > RETURN                                                   null

End of function main

Class Obj:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1SsOJ
function name:  __construct
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
   11     3      > RETURN                                                   null

End of function __construct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/1SsOJ
function name:  __wakeup
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN_OBJ                                               'a'
          1        OP_DATA                                                  42
   15     2        ASSIGN                                                   !0, 0
          3      > JMP                                                      ->8
   16     4    >   CONCAT                                           ~3      'b', !0
          5        ASSIGN_OBJ                                               ~3
          6        OP_DATA                                                  42
   15     7        PRE_INC                                                  !0
          8    >   IS_SMALLER                                               !0, 10000
          9      > JMPNZ                                                    ~6, ->4
   18    10    > > RETURN                                                   null

End of function __wakeup

End of class Obj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.69 ms | 1407 KiB | 24 Q