]> granicus.if.org Git - php/commitdiff
Fixed bug #41283 (Bug with serializing array key that are doubles or
authorIlia Alshanetsky <iliaa@php.net>
Sat, 5 May 2007 15:14:56 +0000 (15:14 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 5 May 2007 15:14:56 +0000 (15:14 +0000)
floats).

NEWS
ext/wddx/tests/bug41283.phpt [new file with mode: 0644]
ext/wddx/wddx.c

diff --git a/NEWS b/NEWS
index 3cc1d359d18024a173d4473fddff8af730258770..872ad724b8b216237fb0754a63f0e58dd701a3ba 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ PHP                                                                        NEWS
 - Fixed altering $this via argument named "this". (Dmitry)
 - Fixed bug #41287 (Namespace functions don't allow xmlns defintion to be 
   optional). (Rob)
+- Fixed bug #41283 (Bug with serializing array key that are doubles or
+  floats). (Ilia)
 - Fixed bug #41257: (lookupNamespaceURI does not work as expected). (Rob)
 - Fixed bug #41097 (ext/soap returning associative array as indexed without
   using WSDL). (Dmitry)
diff --git a/ext/wddx/tests/bug41283.phpt b/ext/wddx/tests/bug41283.phpt
new file mode 100644 (file)
index 0000000..241101f
--- /dev/null
@@ -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"
+    }
+  }
+}
index 3598c7081d9b5a7f2bd6cd8651befb58574569bb..b3acc553e02e51c5e4794cbc4d0f634b9a095169 100644 (file)
@@ -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;