3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Obj { // Testing $this->a being a dynamic property. function __construct($a) { $this->a = $a; } public function __wakeup() { echo "Calling __wakeup\n"; for ($i = 0; $i < 10000; $i++) { $this->{'b' . $i} = 42; } } } function main() { $obj = new stdClass(); $obj->test = 'foo'; $variable = [new Obj($obj), new Obj($obj)]; $serialized = serialize($variable); printf("%s\n", $serialized); $unserialized = unserialize($serialized); 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();

Abusive script

This script was stopped while abusing our resources

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

End of function __wakeup

End of class Obj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.26 ms | 1012 KiB | 18 Q