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

ext/wddx/wddx.c

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,