mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
parent
787593b708
commit
c97b8bbf82
2
NEWS
2
NEWS
@ -36,6 +36,8 @@ PHP NEWS
|
|||||||
- Reflection:
|
- Reflection:
|
||||||
. Fixed bug #76536 (PHP crashes with core dump when throwing exception in
|
. Fixed bug #76536 (PHP crashes with core dump when throwing exception in
|
||||||
error handler). (Laruence)
|
error handler). (Laruence)
|
||||||
|
. Fixed bug #75231 (ReflectionProperty#getValue() incorrectly works with
|
||||||
|
inherited classes). (Nikita)
|
||||||
|
|
||||||
- Standard:
|
- Standard:
|
||||||
. Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys).
|
. Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys).
|
||||||
|
@ -5645,7 +5645,7 @@ ZEND_METHOD(reflection_property, getValue)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instanceof_function(Z_OBJCE_P(object), ref->ce)) {
|
if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) {
|
||||||
_DO_THROW("Given object is not an instance of the class this property was declared in");
|
_DO_THROW("Given object is not an instance of the class this property was declared in");
|
||||||
/* Returns from this function */
|
/* Returns from this function */
|
||||||
}
|
}
|
||||||
|
25
ext/reflection/tests/bug75231.phpt
Normal file
25
ext/reflection/tests/bug75231.phpt
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
--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
|
Loading…
Reference in New Issue
Block a user