mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
c97b8bbf82
The behavior is now consistent with ReflectionMethod.
26 lines
485 B
PHP
26 lines
485 B
PHP
--TEST--
|
|
Bug #75231: ReflectionProperty#getValue() incorrectly works with inherited classes
|
|
--FILE--
|
|
<?php
|
|
class A
|
|
{
|
|
public $prop;
|
|
public function __construct()
|
|
{
|
|
$this->prop = 'prop';
|
|
}
|
|
public function method()
|
|
{
|
|
return 'method';
|
|
}
|
|
}
|
|
class B extends A
|
|
{
|
|
}
|
|
print_r((new ReflectionMethod(B::class, 'method'))->invoke(new A()).PHP_EOL);
|
|
print_r((new ReflectionProperty(B::class, 'prop'))->getValue(new A()).PHP_EOL);
|
|
?>
|
|
--EXPECT--
|
|
method
|
|
prop
|