]> granicus.if.org Git - php/commitdiff
MFH: Use zend_get_property_info() in get_class_vars() (fixes #46812)
authorArnaud Le Blanc <lbarnaud@php.net>
Fri, 22 May 2009 11:19:30 +0000 (11:19 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Fri, 22 May 2009 11:19:30 +0000 (11:19 +0000)
Zend/tests/get_class_vars_003.phpt
Zend/tests/get_class_vars_006.phpt
Zend/zend_builtin_functions.c

index f9dab77c2f41c9caf54ad86855f0ac354de52c60..d2c82bb593744a5b76f474c4696e8abc03c016e2 100644 (file)
@@ -33,7 +33,7 @@ new C;
 
 ?>
 --EXPECT--
-array(5) {
+array(6) {
   ["aaa"]=>
   int(7)
   ["ccc"]=>
@@ -42,6 +42,8 @@ array(5) {
   int(1)
   ["aa"]=>
   int(4)
+  ["bb"]=>
+  int(5)
   ["cc"]=>
   int(6)
 }
index 73de66ba98b09305217a3ff5b6dbfcb83fc1fac6..d1c2844aeba57e56715abd82bdfe252667baea35 100644 (file)
@@ -44,5 +44,7 @@ array(1) {
   ["a"]=>
   int(1)
 }
-array(0) {
+array(1) {
+  ["a"]=>
+  int(1)
 }
index 4c430274c42a46dc5207b781a45163857e761498..6def986c75abbf383070e477737b52e8fa005717 100644 (file)
@@ -890,27 +890,22 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re
                while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) {
                        char *key, *class_name, *prop_name;
                        uint key_len;
-                       ulong num_index, h;
+                       ulong num_index;
                        int prop_name_len = 0;                  
                        zval *prop_copy;
                        zend_property_info *property_info;
+                       zval zprop_name;
 
                        zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos);
                        zend_hash_move_forward_ex(properties, &pos);
 
                        zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
                        prop_name_len = strlen(prop_name);
-                       
-                       h = zend_get_hash_value(prop_name, prop_name_len+1);
-                       if (zend_hash_quick_find(&ce->properties_info, prop_name, prop_name_len+1, h, (void **) &property_info) == FAILURE) {
-                               continue;
-                       }
-                       
-                       if (property_info->flags & ZEND_ACC_SHADOW) {
-                               continue;
-                       } else if ((property_info->flags & ZEND_ACC_PRIVATE) && EG(scope) != ce) {
-                               continue;
-                       } else if ((property_info->flags & ZEND_ACC_PROTECTED) && zend_check_protected(ce, EG(scope)) == 0) {
+
+                       ZVAL_STRINGL(&zprop_name, prop_name, prop_name_len, 0);
+                       property_info = zend_get_property_info(ce, &zprop_name, 1 TSRMLS_CC);
+
+                       if (!property_info || property_info == &EG(std_property_info)) {
                                continue;
                        }