From: Ilia Alshanetsky Date: Wed, 10 Aug 2005 22:45:31 +0000 (+0000) Subject: MFH: Fixed bug #34068 (Numeric string as array key not cast to integer in X-Git-Tag: php-5.1.0RC1~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a37a0c49595c617b5dcc8f0e57c1964c61c11e2;p=php MFH: Fixed bug #34068 (Numeric string as array key not cast to integer in wddx_deserialize()). --- diff --git a/NEWS b/NEWS index 6988c653ba..52134e6300 100644 --- 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). diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 7396dfdfca..d6084475f9 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -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,