]> granicus.if.org Git - php/commitdiff
Improved fix for bug #38132
authorIlia Alshanetsky <iliaa@php.net>
Wed, 26 Jul 2006 23:18:41 +0000 (23:18 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 26 Jul 2006 23:18:41 +0000 (23:18 +0000)
ext/reflection/php_reflection.c
ext/reflection/tests/bug38132.phpt

index d6a5f909ed443c983736b54fa5c4894214192860..62d30956fbfc94a25e0290d91a5e9e92fc6cdd4a 100644 (file)
@@ -2643,19 +2643,13 @@ ZEND_METHOD(reflection_class, getStaticProperties)
                ulong num_index;
 
                if (zend_hash_get_current_key_ex(CE_STATIC_MEMBERS(ce), &key, &key_len, &num_index, 0, &pos) != FAILURE && key) {
-                       zval_add_ref(value);
+                       char *prop_name, *class_name;
 
-                       if (*key == '\0') {
-                               *key++;
-                               key_len--;
-                               
-                       }
-                       if (*key == '*' && *(key+1) == '\0') {
-                               *(key+1) = *key++;
-                               key_len--;
-                       }
+                       zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
+
+                       zval_add_ref(value);
 
-                       zend_hash_update(Z_ARRVAL_P(return_value), key, key_len, value, sizeof(zval *), NULL);
+                       zend_hash_update(Z_ARRVAL_P(return_value), prop_name, strlen(prop_name)+1, value, sizeof(zval *), NULL);
                }
                zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos);
        }
index eaaca850d85d557d6373cd1472d598d7de6d8524..aeb6246b89f29475ede6d74c0defc9f8a6e20531 100755 (executable)
@@ -12,22 +12,23 @@ class foo {
 $class = new ReflectionClass('foo');
 $properties = $class->getStaticProperties();
 var_dump($properties, array_keys($properties));
-var_dump(isset($properties['*bar'])); // false
-var_dump(isset($properties["\0*\0bar"])); // true
-
+var_dump(isset($properties['*bar']));
+var_dump(isset($properties["\0*\0bar"]));
+var_dump(isset($properties["bar"]));
 ?>
 --EXPECT--
 array(2) {
-  ["*bar"]=>
+  ["bar"]=>
   string(3) "baz"
   ["a"]=>
   string(1) "a"
 }
 array(2) {
   [0]=>
-  string(4) "*bar"
+  string(3) "bar"
   [1]=>
   string(1) "a"
 }
-bool(true)
 bool(false)
+bool(false)
+bool(true)