diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/reflection/php_reflection.c | 1 | ||||
-rw-r--r-- | ext/reflection/tests/ReflectionParameter_isDefault.phpt | 34 |
3 files changed, 37 insertions, 0 deletions
@@ -41,6 +41,8 @@ sequences. (Gustavo) - Fixed bug #52929 (Segfault in filter_var with FILTER_VALIDATE_EMAIL with large amount of data) (CVE-2010-3710). (Adam) +- Fixed ReflectionProperty::isDefault() giving a wrong result for properties + obtained with ReflectionClass::getProperties(). (Gustavo) - Fixed bug #53144 (Segfault in SplObjectStorage::removeAll()). (Felipe) - Fixed bug #53071 (SPLObjectStorage defeats gc_collect_cycles). (Gustavo) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 7216400827..7b130f8fd3 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3660,6 +3660,7 @@ static int _adddynproperty(zval **pptr TSRMLS_DC, int num_args, va_list args, ze ZVAL_STRINGL(&member, hash_key->arKey, hash_key->nKeyLength-1, 0); if (zend_get_property_info(ce, &member, 1 TSRMLS_CC) == &EG(std_property_info)) { MAKE_STD_ZVAL(property); + EG(std_property_info).flags = ZEND_ACC_IMPLICIT_PUBLIC; reflection_property_factory(ce, &EG(std_property_info), property TSRMLS_CC); add_next_index_zval(retval, property); } diff --git a/ext/reflection/tests/ReflectionParameter_isDefault.phpt b/ext/reflection/tests/ReflectionParameter_isDefault.phpt new file mode 100644 index 0000000000..657077093b --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_isDefault.phpt @@ -0,0 +1,34 @@ +--TEST--
+ReflectionParameter::isDefault()
+--FILE--
+<?php
+class A {
+public $defprop;
+}
+$a = new A;
+$a->myprop = null;
+
+$ro = new ReflectionObject($a);
+$props = $ro->getProperties();
+$prop1 = $props[0];
+var_dump($prop1->isDefault());
+$prop2 = $props[1];
+var_dump($prop2->isDefault());
+
+var_dump($ro->getProperty('defprop')->isDefault());
+var_dump($ro->getProperty('myprop')->isDefault());
+
+$prop1 = new ReflectionProperty($a, 'defprop');
+$prop2 = new ReflectionProperty($a, 'myprop');
+var_dump($prop1->isDefault());
+var_dump($prop2->isDefault());
+?>
+==DONE==
+--EXPECT--
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+==DONE==
|