]> granicus.if.org Git - php/commitdiff
- Fixed wrong check for dynamic properties
authorFelipe Pena <felipe@php.net>
Mon, 11 Aug 2008 13:35:49 +0000 (13:35 +0000)
committerFelipe Pena <felipe@php.net>
Mon, 11 Aug 2008 13:35:49 +0000 (13:35 +0000)
ext/reflection/php_reflection.c
ext/reflection/tests/024.phpt

index 067677d72da12c3f4efce9a9c93c97b921e84d3e..6a464f6902e7e0d93eb77848422af2a41d4d7c34 100644 (file)
@@ -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);   
                                        }
index d1af28dfc9bab0fa7d3193ce1dc43d20228eaab7..a1c2c81a9307f4ad9ef93a5afd6fa5817c318cb5 100755 (executable)
@@ -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 [ <user> class C1 ] {
   }
 
   - Dynamic properties [1] {
-    Property [ <dynamic> public $p3 ]
+    Property [ <dynamic> public $z ]
   }
 
   - Methods [0] {