mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.0'
Conflicts: ext/reflection/php_reflection.c
This commit is contained in:
commit
20560da118
3 changed files with 48 additions and 3 deletions
|
@ -5649,9 +5649,16 @@ ZEND_METHOD(reflection_property, getValue)
|
|||
}
|
||||
|
||||
zend_unmangle_property_name_ex(ref->prop.name, &class_name, &prop_name, &prop_name_len);
|
||||
member_p = zend_read_property(ref->ce, object, prop_name, prop_name_len, 1, &rv);
|
||||
ZVAL_DEREF(member_p);
|
||||
ZVAL_COPY(return_value, member_p);
|
||||
member_p = zend_read_property(ref->ce, object, prop_name, prop_name_len, 0, &rv);
|
||||
if (member_p != &rv) {
|
||||
ZVAL_DEREF(member_p);
|
||||
ZVAL_COPY(return_value, member_p);
|
||||
} else {
|
||||
if (Z_ISREF_P(member_p)) {
|
||||
zend_unwrap_reference(member_p);
|
||||
}
|
||||
ZVAL_COPY_VALUE(return_value, member_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
|
|
@ -78,4 +78,6 @@ Protected property:
|
|||
Cannot access non-public member TestClass::prot
|
||||
|
||||
Instance without property:
|
||||
|
||||
Notice: Undefined property: AnotherClass::$pub2 in %s on line %d
|
||||
NULL
|
||||
|
|
36
ext/reflection/tests/bug72174.phpt
Normal file
36
ext/reflection/tests/bug72174.phpt
Normal file
|
@ -0,0 +1,36 @@
|
|||
--TEST--
|
||||
Bug #72174: ReflectionProperty#getValue() causes __isset call
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo
|
||||
{
|
||||
private $bar;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
unset($this->bar);
|
||||
}
|
||||
|
||||
public function __isset($name)
|
||||
{
|
||||
var_dump(__METHOD__);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
var_dump(__METHOD__);
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
$instance = new Foo();
|
||||
$reflectionBar = (new ReflectionProperty(Foo::class, 'bar'));
|
||||
$reflectionBar->setAccessible(true);
|
||||
var_dump($reflectionBar->getValue($instance));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(10) "Foo::__get"
|
||||
string(3) "bar"
|
Loading…
Add table
Add a link
Reference in a new issue