cvs: php-src(PHP_5_2) /ext/reflection php_reflection.c /ext/reflection/tests bug38132.phpt

From: Date: Wed, 26 Jul 2006 23:18:41 +0000
Subject: cvs: php-src(PHP_5_2) /ext/reflection php_reflection.c /ext/reflection/tests bug38132.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-39550@lists.php.net to get a copy of this message
iliaa Wed Jul 26 23:18:41 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug38132.phpt Log: Improved fix for bug #38132 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.18&r2=1.164.2.33.2.19&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.18 php-src/ext/reflection/php_reflection.c:1.164.2.33.2.19 --- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.18 Wed Jul 26 08:03:48 2006 +++ php-src/ext/reflection/php_reflection.c Wed Jul 26 23:18:41 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_reflection.c,v 1.164.2.33.2.18 2006/07/26 08:03:48 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.164.2.33.2.19 2006/07/26 23:18:41 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2643,19 +2643,13 @@ 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); } @@ -4800,7 +4794,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.18 2006/07/26 08:03:48 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.19 2006/07/26 23:18:41 iliaa Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38132.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/reflection/tests/bug38132.phpt diff -u php-src/ext/reflection/tests/bug38132.phpt:1.1.2.1 php-src/ext/reflection/tests/bug38132.phpt:1.1.2.2 --- php-src/ext/reflection/tests/bug38132.phpt:1.1.2.1 Tue Jul 25 14:06:52 2006 +++ php-src/ext/reflection/tests/bug38132.phpt Wed Jul 26 23:18:41 2006 @@ -12,22 +12,23 @@ $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)

« previous php.cvs (#39550) next »