]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #34068 (Numeric string as array key not cast to integer in
authorIlia Alshanetsky <iliaa@php.net>
Wed, 10 Aug 2005 22:45:31 +0000 (22:45 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 10 Aug 2005 22:45:31 +0000 (22:45 +0000)
wddx_deserialize()).

NEWS
ext/wddx/wddx.c

diff --git a/NEWS b/NEWS
index 6988c653ba2c29b7b4a2e1b597cd0eab11e349d2..52134e630004d9b651c11fda41de07fe9db143c8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ PHP                                                                        NEWS
 - Fixed "make test" to work for phpized extensions. (Hartmut, Jani)
 - Fixed failing queries (FALSE returned) with mysqli_query() on 64 bit systems.
   (Andrey)
+- Fixed bug #34068 (Numeric string as array key not cast to integer in 
+  wddx_deserialize()). (Ilia)
 - Fixed bug #34064 (arr[] as param to function in class gives invalid opcode).
   (Dmitry)
 - Fixed bug #34062 (Crash in catch block when many arguments are used).
index 7396dfdfca97c868e13e9134a870ec3f23bd95f9..d6084475f948a9fb0fca74b580e09472ab55f953 100644 (file)
@@ -997,10 +997,20 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
                                                ent1->data->refcount--;
                                                add_property_zval(ent2->data, ent1->varname, ent1->data);
                                                EG(scope) = old_scope;
-                                       } else
-                                               zend_hash_update(target_hash,
-                                                                                ent1->varname, strlen(ent1->varname)+1,
-                                                                                &ent1->data, sizeof(zval *), NULL);
+                                       } else {
+                                               long l;  
+                                               double d;
+                               
+                                               switch (is_numeric_string(ent1->varname, strlen(ent1->varname), &l, &d, 0)) {
+                                                       case IS_DOUBLE:
+                                                               l = (long) d;
+                                                       case IS_LONG:
+                                                               zend_hash_index_update(target_hash, l, &ent1->data, sizeof(zval *), NULL);
+                                                               break;
+                                                       default:
+                                                               zend_hash_update(target_hash,ent1->varname, strlen(ent1->varname)+1, &ent1->data, sizeof(zval *), NULL);
+                                               }
+                                       }
                                        efree(ent1->varname);
                                } else  {
                                        zend_hash_next_index_insert(target_hash,