From: Ilia Alshanetsky Date: Mon, 11 Jun 2007 15:08:43 +0000 (+0000) Subject: Fixed bug #41527 (WDDX deserialize numeric string array key). X-Git-Tag: php-5.2.4RC1~369 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6762a899171799a829417a4a68ce66824b7c9e7;p=php Fixed bug #41527 (WDDX deserialize numeric string array key). --- diff --git a/NEWS b/NEWS index 1fbaf6ce8e..4d3fd5da98 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,8 @@ PHP NEWS with ini_set()). (Tony, Dmitry) - Fixed bug #41555 (configure failure: regression caused by fix for #41265). (Jani) +- Fixed bug #41527 (WDDX deserialize numeric string array key). (php_lists + at realplain dot com, Ilia) - Fixed bug #41518 (file_exists() warns of open_basedir restriction on non-existent file). (Tony) - Fixed bug #39330 (apache2handler does not call shutdown actions before diff --git a/ext/wddx/tests/bug41527.phpt b/ext/wddx/tests/bug41527.phpt new file mode 100644 index 0000000000..447bfc34d1 --- /dev/null +++ b/ext/wddx/tests/bug41527.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #41527 (WDDX deserialize numeric string array keys) +--SKIPIF-- + +--FILE-- + 'Zero', '+1' => 'Plus sign', ' 1' => 'Space'); + +var_dump(wddx_deserialize(wddx_serialize_vars('data'))); +?> +--EXPECT-- +array(1) { + ["data"]=> + array(3) { + ["01"]=> + string(4) "Zero" + ["+1"]=> + string(9) "Plus sign" + [" 1"]=> + string(5) "Space" + } +} diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index b3acc553e0..a3ff9870bf 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -974,26 +974,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) add_property_zval(ent2->data, ent1->varname, ent1->data); EG(scope) = old_scope; } else { - long l; - double d; - int varname_len = strlen(ent1->varname); - - switch (is_numeric_string(ent1->varname, varname_len, &l, &d, 0)) { - case IS_DOUBLE: - if (d > INT_MAX) { - goto bigint; - } - l = (long) d; - if (l != d) { - goto bigint; - } - case IS_LONG: - zend_hash_index_update(target_hash, l, &ent1->data, sizeof(zval *), NULL); - break; - default: -bigint: - zend_hash_update(target_hash,ent1->varname, varname_len + 1, &ent1->data, sizeof(zval *), NULL); - } + zend_symtable_update(target_hash, ent1->varname, strlen(ent1->varname)+1, &ent1->data, sizeof(zval *), NULL); } efree(ent1->varname); } else {