dmitry          Thu Jul 27 09:19:26 2006 UTC

  Modified files:              
    /php-src/ext/reflection     php_reflection.c 
    /php-src/ext/reflection/tests       bug38132.phpt 
  Log:
  Fix usage of uninitialized value and unicode support
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.248&r2=1.249&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.248 
php-src/ext/reflection/php_reflection.c:1.249
--- php-src/ext/reflection/php_reflection.c:1.248       Thu Jul 27 00:22:07 2006
+++ php-src/ext/reflection/php_reflection.c     Thu Jul 27 09:19:25 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.248 2006/07/27 00:22:07 iliaa Exp $ */
+/* $Id: php_reflection.c,v 1.249 2006/07/27 09:19:25 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -2645,8 +2645,8 @@
 {
        reflection_object *intern;
        zend_class_entry *ce;
-        HashPosition pos;
-        zval **value;
+       HashPosition pos;
+       zval **value;
        
        METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);    
        GET_REFLECTION_OBJECT_PTR(ce);
@@ -2663,13 +2663,14 @@
 
                if (zend_hash_get_current_key_ex(CE_STATIC_MEMBERS(ce), &key, 
&key_len, &num_index, 0, &pos) != FAILURE) {
                        zstr prop_name, class_name;
-                       int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) 
: strlen(prop_name.s);
+                       int prop_name_len;
 
                        
zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, 
&class_name, &prop_name);
+                       prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : 
strlen(prop_name.s);
 
                        zval_add_ref(value);
 
-                       zend_u_hash_update(Z_ARRVAL_P(return_value), 
UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len, value, sizeof(zval 
*), NULL);
+                       zend_u_hash_update(Z_ARRVAL_P(return_value), 
UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len+1, value, 
sizeof(zval *), NULL);
                }
                zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos);
        }
@@ -4864,7 +4865,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.248 
2006/07/27 00:22:07 iliaa Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.249 
2006/07/27 09:19:25 dmitry Exp $");
 
        php_info_print_table_end();
 } /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38132.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/reflection/tests/bug38132.phpt
diff -u php-src/ext/reflection/tests/bug38132.phpt:1.2 
php-src/ext/reflection/tests/bug38132.phpt:1.3
--- php-src/ext/reflection/tests/bug38132.phpt:1.2      Wed Jul 26 23:32:07 2006
+++ php-src/ext/reflection/tests/bug38132.phpt  Thu Jul 27 09:19:26 2006
@@ -32,3 +32,19 @@
 bool(false)
 bool(false)
 bool(true)
+--UEXPECT--
+array(2) {
+  [u"bar"]=>
+  unicode(3) "baz"
+  [u"a"]=>
+  unicode(1) "a"
+}
+array(2) {
+  [0]=>
+  unicode(3) "bar"
+  [1]=>
+  unicode(1) "a"
+}
+bool(false)
+bool(false)
+bool(true)

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

Reply via email to