summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-06-11 15:08:43 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-06-11 15:08:43 +0000
commitb6762a899171799a829417a4a68ce66824b7c9e7 (patch)
tree38d1520255237ec24c3513a61838e6273f64fd64
parent3b61fd82863fe9ce28fdb2fa0c8c5fe47be87809 (diff)
downloadphp-git-b6762a899171799a829417a4a68ce66824b7c9e7.tar.gz
Fixed bug #41527 (WDDX deserialize numeric string array key).
-rw-r--r--NEWS2
-rw-r--r--ext/wddx/tests/bug41527.phpt22
-rw-r--r--ext/wddx/wddx.c21
3 files changed, 25 insertions, 20 deletions
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--
+<?php if (!extension_loaded("wddx")) print "skip"; ?>
+--FILE--
+<?php
+$data = array('01' => '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 {