3v4l.org

run code in 500+ PHP versions simultaneously
<?php class ReadonlyWakeupWithReflection { public function __construct(public readonly string $value) {} public function __wakeup(): void { (new \ReflectionProperty($this, 'value'))->setValue($this, 'set by reflection on wakeup'); } } $obj = new ReadonlyWakeupWithReflection('test'); $serialized = serialize($obj); $unserialized = unserialize($serialized); print $unserialized->value;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3mViB
function name:  (null)
number of ops:  15
compiled vars:  !0 = $obj, !1 = $serialized, !2 = $unserialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   NEW                                                  $3      'ReadonlyWakeupWithReflection'
          1        SEND_VAL_EX                                                  'test'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $3
   12     4        INIT_FCALL                                                   'serialize'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $6      
          7        ASSIGN                                                       !1, $6
   13     8        INIT_FCALL                                                   'unserialize'
          9        SEND_VAR                                                     !1
         10        DO_ICALL                                             $8      
         11        ASSIGN                                                       !2, $8
   14    12        FETCH_OBJ_R                                          ~10     !2, 'value'
         13        ECHO                                                         ~10
   15    14      > RETURN                                                       1

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

End of function __construct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3mViB
function name:  __wakeup
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   NEW                                                  $0      'ReflectionProperty'
          1        FETCH_THIS                                           $1      
          2        SEND_VAR_EX                                                  $1
          3        SEND_VAL_EX                                                  'value'
          4        DO_FCALL                                          0          
          5        INIT_METHOD_CALL                                             $0, 'setValue'
          6        FETCH_THIS                                           $3      
          7        SEND_VAR_EX                                                  $3
          8        SEND_VAL_EX                                                  'set+by+reflection+on+wakeup'
          9        DO_FCALL                                          0          
    8    10      > RETURN                                                       null

End of function __wakeup

End of class ReadonlyWakeupWithReflection.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.79 ms | 1336 KiB | 15 Q