From: Felipe Pena Date: Mon, 11 Aug 2008 13:35:49 +0000 (+0000) Subject: - Fixed wrong check for dynamic properties X-Git-Tag: BEFORE_HEAD_NS_CHANGE~774 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ea60b6f45c585f2fd2d1203f4a63ec1fddc03ad;p=php - Fixed wrong check for dynamic properties --- diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 067677d72d..6a464f6902 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -509,9 +509,8 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in ulong index; if ((prop_type = zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 0, &pos)) == (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) { - if (prop_name_size && (UG(unicode)?prop_name.u[0]:prop_name.s[0])) { - /* skip all private and protected properties */ - if (zend_u_hash_exists(&ce->properties_info, prop_type, prop_name, prop_name_size)) { + if (prop_name_size && (UG(unicode)?prop_name.u[0]:prop_name.s[0])) { /* skip all private and protected properties */ + if (!zend_u_hash_exists(&ce->properties_info, prop_type, prop_name, prop_name_size)) { count++; _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); } diff --git a/ext/reflection/tests/024.phpt b/ext/reflection/tests/024.phpt index d1af28dfc9..a1c2c81a93 100755 --- a/ext/reflection/tests/024.phpt +++ b/ext/reflection/tests/024.phpt @@ -9,7 +9,12 @@ class C1 { protected $p2 = 2; public $p3 = 3; } -$obj = new ReflectionObject(new C1()); + +$x = new C1(); +$x->z = 4; +$x->p3 = 5; + +$obj = new ReflectionObject($x); echo $obj; ?> --EXPECTF-- @@ -32,7 +37,7 @@ Object of class [ class C1 ] { } - Dynamic properties [1] { - Property [ public $p3 ] + Property [ public $z ] } - Methods [0] {