3v4l.org

run code in 300+ 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:  38
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        INIT_FCALL                                               'property_exists'
         27        SEND_VAL                                                 'FooHack'
         28        SEND_VAL                                                 'bar'
         29        DO_ICALL                                         $16     
         30        SEND_VAR                                                 $16
   24    31        INIT_FCALL                                               'property_exists'
         32        SEND_VAR                                                 !0
         33        SEND_VAL                                                 'bar'
         34        DO_ICALL                                         $17     
         35        SEND_VAR                                                 $17
   22    36        DO_ICALL                                                 
   25    37      > 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.0.0


preferences:
139.73 ms | 1004 KiB | 15 Q