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. public function __construct($a) { $this->a = $a; } public function __wakeup() { for ($i = 0; $i < 10000; $i++) { $this->{'b' . $i} = 42; } } } function main() { $obj = (object)["test" => 'foo']; // object used twice as properties of other objects. $variable = [new Obj($obj), new Obj($obj)]; $serialized = serialize($variable); printf("%s\n", $serialized); $unserialized = unserialize($serialized); echo "Called __unserialize\n"; for ($a = 0; $a < 2; $a++) { for ($i = 0; $i < 10000; $i++) { if ($unserialized[$a]->{'b' . $i} !== 42) { echo "Fail $a b$i\n"; return; } unset($unserialized[$a]->{'b' . $i}); } } var_dump($unserialized); } main();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DkcB5
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   33     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 = 47
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 26
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 28
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 26
Branch analysis from position: 49
Branch analysis from position: 26
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 40
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 28
Branch analysis from position: 46
Branch analysis from position: 28
filename:       /in/DkcB5
function name:  main
number of ops:  53
compiled vars:  !0 = $obj, !1 = $variable, !2 = $serialized, !3 = $unserialized, !4 = $a, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   CAST                                          8  ~6      <array>
          1        ASSIGN                                                   !0, ~6
   17     2        NEW                                              $8      'Obj'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        INIT_ARRAY                                       ~10     $8
          6        NEW                                              $11     'Obj'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ADD_ARRAY_ELEMENT                                ~10     $11
         10        ASSIGN                                                   !1, ~10
   18    11        INIT_FCALL                                               'serialize'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $14     
         14        ASSIGN                                                   !2, $14
   19    15        INIT_FCALL                                               'printf'
         16        SEND_VAL                                                 '%25s%0A'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   20    19        INIT_FCALL                                               'unserialize'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $17     
         22        ASSIGN                                                   !3, $17
   21    23        ECHO                                                     'Called+__unserialize%0A'
   22    24        ASSIGN                                                   !4, 0
         25      > JMP                                                      ->47
   23    26    >   ASSIGN                                                   !5, 0
         27      > JMP                                                      ->44
   24    28    >   CONCAT                                           ~22     'b', !5
         29        FETCH_DIM_R                                      ~21     !3, !4
         30        FETCH_OBJ_R                                      ~23     ~21, ~22
         31        IS_NOT_IDENTICAL                                         ~23, 42
         32      > JMPZ                                                     ~24, ->40
   25    33    >   ROPE_INIT                                     5  ~26     'Fail+'
         34        ROPE_ADD                                      1  ~26     ~26, !4
         35        ROPE_ADD                                      2  ~26     ~26, '+b'
         36        ROPE_ADD                                      3  ~26     ~26, !5
         37        ROPE_END                                      4  ~25     ~26, '%0A'
         38        ECHO                                                     ~25
   26    39      > RETURN                                                   null
   28    40    >   CONCAT                                           ~30     'b', !5
         41        FETCH_DIM_UNSET                                  $29     !3, !4
         42        UNSET_OBJ                                                $29, ~30
   23    43        PRE_INC                                                  !5
         44    >   IS_SMALLER                                               !5, 10000
         45      > JMPNZ                                                    ~32, ->28
   22    46    >   PRE_INC                                                  !4
         47    >   IS_SMALLER                                               !4, 2
         48      > JMPNZ                                                    ~34, ->26
   31    49    >   INIT_FCALL                                               'var_dump'
         50        SEND_VAR                                                 !3
         51        DO_ICALL                                                 
   32    52      > 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/DkcB5
function name:  __construct
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

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

End of function __wakeup

End of class Obj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.28 ms | 1406 KiB | 24 Q