cataphract Tue, 26 Oct 2010 18:47:10 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=304935
Log:
- Fixed ReflectionProperty::isDefault() giving a wrong result for properties
obtained with ReflectionClass::getProperties().
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
A
php/php-src/branches/PHP_5_3/ext/reflection/tests/ReflectionParameter_isDefault.phpt
U php/php-src/trunk/ext/reflection/php_reflection.c
A
php/php-src/trunk/ext/reflection/tests/ReflectionParameter_isDefault.phpt
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-10-26 18:10:04 UTC (rev 304934)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-10-26 18:47:10 UTC (rev 304935)
@@ -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)
Modified: php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
2010-10-26 18:10:04 UTC (rev 304934)
+++ php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
2010-10-26 18:47:10 UTC (rev 304935)
@@ -3660,6 +3660,7 @@
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);
}
Added:
php/php-src/branches/PHP_5_3/ext/reflection/tests/ReflectionParameter_isDefault.phpt
===================================================================
---
php/php-src/branches/PHP_5_3/ext/reflection/tests/ReflectionParameter_isDefault.phpt
(rev 0)
+++
php/php-src/branches/PHP_5_3/ext/reflection/tests/ReflectionParameter_isDefault.phpt
2010-10-26 18:47:10 UTC (rev 304935)
@@ -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==
Modified: php/php-src/trunk/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/trunk/ext/reflection/php_reflection.c 2010-10-26 18:10:04 UTC
(rev 304934)
+++ php/php-src/trunk/ext/reflection/php_reflection.c 2010-10-26 18:47:10 UTC
(rev 304935)
@@ -3902,6 +3902,7 @@
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);
}
Added: php/php-src/trunk/ext/reflection/tests/ReflectionParameter_isDefault.phpt
===================================================================
--- php/php-src/trunk/ext/reflection/tests/ReflectionParameter_isDefault.phpt
(rev 0)
+++ php/php-src/trunk/ext/reflection/tests/ReflectionParameter_isDefault.phpt
2010-10-26 18:47:10 UTC (rev 304935)
@@ -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==
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php