From: Ilia Alshanetsky Date: Sat, 5 May 2007 15:14:56 +0000 (+0000) Subject: Fixed bug #41283 (Bug with serializing array key that are doubles or X-Git-Tag: php-5.2.3RC1~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c70105610a1266bdfcba050502ea63459fa1e6f0;p=php Fixed bug #41283 (Bug with serializing array key that are doubles or floats). --- diff --git a/NEWS b/NEWS index 3cc1d359d1..872ad724b8 100644 --- 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 index 0000000000..241101f2a4 --- /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-- + +--FILE-- + 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 3598c7081d..b3acc553e0 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;