xref: /PHP-8.4/ext/reflection/tests/bug75231.phpt (revision c97b8bbf)
1--TEST--
2Bug #75231: ReflectionProperty#getValue() incorrectly works with inherited classes
3--FILE--
4<?php
5class A
6{
7    public $prop;
8    public function __construct()
9    {
10        $this->prop = 'prop';
11    }
12    public function method()
13    {
14        return 'method';
15    }
16}
17class B extends A
18{
19}
20print_r((new ReflectionMethod(B::class, 'method'))->invoke(new A()).PHP_EOL);
21print_r((new ReflectionProperty(B::class, 'prop'))->getValue(new A()).PHP_EOL);
22?>
23--EXPECT--
24method
25prop
26