summaryrefslogtreecommitdiff
path: root/ext/wddx
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-05-05 15:14:56 (GMT)
committerIlia Alshanetsky <iliaa@php.net>2007-05-05 15:14:56 (GMT)
commitc70105610a1266bdfcba050502ea63459fa1e6f0 (patch)
tree576b735ad31aba1fd4efe4dfe5c1bccd7711ceca /ext/wddx
parent9fd3c30f944f7439e40792a59518e95f8307c7ca (diff)
downloadphp-c70105610a1266bdfcba050502ea63459fa1e6f0.tar.gz
Fixed bug #41283 (Bug with serializing array key that are doubles or
floats).
Diffstat (limited to 'ext/wddx')
-rw-r--r--ext/wddx/tests/bug41283.phpt27
-rw-r--r--ext/wddx/wddx.c3
2 files changed, 30 insertions, 0 deletions
diff --git a/ext/wddx/tests/bug41283.phpt b/ext/wddx/tests/bug41283.phpt
new file mode 100644
index 0000000..241101f
--- /dev/null
+++ b/ext/wddx/tests/bug41283.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #41283 (Bug with serializing array key that are doubles or floats)
+--SKIPIF--
+<?php if (!extension_loaded("wddx")) print "skip"; ?>
+--FILE--
+<?php
+$data = array(
+ 'somearray' => array('1.1' => 'One 1','1.2' => 'One 2', '1.0' => 'Three')
+);
+
+var_dump(wddx_deserialize(wddx_serialize_vars('data')));
+?>
+--EXPECT--
+array(1) {
+ ["data"]=>
+ array(1) {
+ ["somearray"]=>
+ array(3) {
+ ["1.1"]=>
+ string(5) "One 1"
+ ["1.2"]=>
+ string(5) "One 2"
+ [1]=>
+ string(5) "Three"
+ }
+ }
+}
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 3598c70..b3acc55 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -984,6 +984,9 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
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;