iliaa           Tue Jul 25 14:06:52 2006 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/reflection/tests       bug38132.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/reflection     php_reflection.c 
  Log:
  Fixed bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key
  names).
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.145&r2=1.2027.2.547.2.146&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.145 php-src/NEWS:1.2027.2.547.2.146
--- php-src/NEWS:1.2027.2.547.2.145     Tue Jul 25 13:40:04 2006
+++ php-src/NEWS        Tue Jul 25 14:06:51 2006
@@ -11,6 +11,8 @@
 
 - Fixed bug #38194 (ReflectionClass::isSubclassOf() returns TRUE for the class
   itself). (Ilia)
+- Fixed bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key
+  names). (Ilia)
 
 24 Jul 2006, PHP 5.2.0RC1
 - Updated bundled MySQL client library to version 5.0.22 in the Windows
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.15&r2=1.164.2.33.2.16&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.15 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.16
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.15     Tue Jul 25 
12:34:38 2006
+++ php-src/ext/reflection/php_reflection.c     Tue Jul 25 14:06:52 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.15 2006/07/25 12:34:38 iliaa Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.16 2006/07/25 14:06:52 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -2623,17 +2623,42 @@
    Returns an associative array containing all static property values of the 
class */
 ZEND_METHOD(reflection_class, getStaticProperties)
 {
-       zval *tmp_copy;
        reflection_object *intern;
        zend_class_entry *ce;
-       
+        HashPosition pos;
+        zval **value;
+
        METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);    
        GET_REFLECTION_OBJECT_PTR(ce);
 
        zend_update_class_constants(ce TSRMLS_CC);
 
        array_init(return_value);
-       zend_hash_copy(Z_ARRVAL_P(return_value), CE_STATIC_MEMBERS(ce), 
(copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
+
+       zend_hash_internal_pointer_reset_ex(CE_STATIC_MEMBERS(ce), &pos);
+
+       while (zend_hash_get_current_data_ex(CE_STATIC_MEMBERS(ce), (void **) 
&value, &pos) == SUCCESS) {
+               uint key_len;
+               char *key;
+               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);
+
+                       if (*key == '\0') {
+                               *key++;
+                               key_len--;
+                               
+                       }
+                       if (*key == '*' && *(key+1) == '\0') {
+                               *(key+1) = *key++;
+                               key_len--;
+                       }
+
+                       zend_hash_update(Z_ARRVAL_P(return_value), key, 
key_len, value, sizeof(zval *), NULL);
+                }
+               zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos);
+       }
 }
 /* }}} */
 
@@ -4767,7 +4792,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.15 2006/07/25 12:34:38 iliaa Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 
1.164.2.33.2.16 2006/07/25 14:06:52 iliaa Exp $");
 
        php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38132.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/bug38132.phpt
+++ php-src/ext/reflection/tests/bug38132.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to