From: Ilia Alshanetsky Date: Mon, 11 Jun 2007 15:10:12 +0000 (+0000) Subject: MFB: Fixed bug #41527 (WDDX deserialize numeric string array key). X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~476 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=59d10d5c4feb17a04a53da9334a84178bd9df986;p=php MFB: Fixed bug #41527 (WDDX deserialize numeric string array key). --- diff --git a/ext/wddx/tests/bug41283.phpt b/ext/wddx/tests/bug41283.phpt index 241101f2a4..af716d1893 100644 --- a/ext/wddx/tests/bug41283.phpt +++ b/ext/wddx/tests/bug41283.phpt @@ -20,7 +20,7 @@ array(1) { string(5) "One 1" ["1.2"]=> string(5) "One 2" - [1]=> + ["1.0"]=> string(5) "Three" } } 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 0282da2fde..0c1aedf1eb 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -975,25 +975,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; - - switch (is_numeric_string(ent1->varname, strlen(ent1->varname), &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, strlen(ent1->varname)+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 {