From: Ilia Alshanetsky Date: Wed, 10 Aug 2005 22:39:12 +0000 (+0000) Subject: MFH: Fixed bug #34068 (Numeric string as array key not cast to integer in X-Git-Tag: php-4.4.1RC1~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=538965c2a8b859e6d21eb566c26a5cda7e1a24ae;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 7317434606..907bed68d3 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2005, Version 4.4.1 +- Fixed bug #34068 (Numeric string as array key not cast to integer in + wddx_deserialize()). (Ilia) - Fixed bug #34064 (arr[] as param to function is allowed only if function receives argument by reference). (Dmitry) - Fixed bug #33989 (extract($GLOBALS,EXTR_REFS) crashes PHP). (Dmitry) diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 3a16dc95d0..bd61c44b67 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -979,10 +979,20 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) /* Clean up class name var entry */ zval_ptr_dtor(&ent1->data); - } 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,