3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public $bar = 'bar'; public $baz = 'baz'; } class FooHack extends Foo { public function __construct(Foo $wrapped) { unset($this->bar); } } $foo = new FooHack(new Foo); $reflectionFooBar = new \ReflectionProperty(Foo::class, 'bar'); var_dump((new ReflectionClass(Foo::class))->getProperties()); var_dump($reflectionFooBar->getValue($foo)); var_dump( property_exists(FooHack::class, 'bar'), property_exists($foo, 'bar') );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VDMHm
function name:  (null)
number of ops:  32
compiled vars:  !0 = $foo, !1 = $reflectionFooBar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   NEW                                                  $2      'FooHack'
          1        NEW                                                  $3      'Foo'
          2        DO_FCALL                                          0          
          3        SEND_VAR_NO_REF_EX                                           $3
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !0, $2
   19     6        NEW                                                  $7      'ReflectionProperty'
          7        SEND_VAL_EX                                                  'Foo'
          8        SEND_VAL_EX                                                  'bar'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !1, $7
   20    11        INIT_FCALL                                                   'var_dump'
         12        NEW                                                  $10     'ReflectionClass'
         13        SEND_VAL_EX                                                  'Foo'
         14        DO_FCALL                                          0          
         15        INIT_METHOD_CALL                                             $10, 'getProperties'
         16        DO_FCALL                                          0  $12     
         17        SEND_VAR                                                     $12
         18        DO_ICALL                                                     
   21    19        INIT_FCALL                                                   'var_dump'
         20        INIT_METHOD_CALL                                             !1, 'getValue'
         21        SEND_VAR_EX                                                  !0
         22        DO_FCALL                                          0  $14     
         23        SEND_VAR                                                     $14
         24        DO_ICALL                                                     
   22    25        INIT_FCALL                                                   'var_dump'
   23    26        FRAMELESS_ICALL_2                property_exists      ~16     'FooHack', 'bar'
         27        SEND_VAL                                                     ~16
   24    28        FRAMELESS_ICALL_2                property_exists      ~17     !0, 'bar'
         29        SEND_VAL                                                     ~17
   22    30        DO_ICALL                                                     
   25    31      > RETURN                                                       1

Class Foo: [no user functions]
Class FooHack:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VDMHm
function name:  __construct
number of ops:  3
compiled vars:  !0 = $wrapped
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
   13     1        UNSET_OBJ                                                    'bar'
   14     2      > RETURN                                                       null

End of function __construct

End of class FooHack.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.32 ms | 2282 KiB | 14 Q