From: Felipe Pena Date: Mon, 15 Jun 2009 17:36:00 +0000 (+0000) Subject: - MFH: Fixed bug #48557 (Numeric string keys in Apache Hashmaps are not cast to integ... X-Git-Tag: php-5.2.10~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51781931e25b39bd4c9ca401596c0391d6132a5c;p=php - MFH: Fixed bug #48557 (Numeric string keys in Apache Hashmaps are not cast to integers) patch by David Zülke --- diff --git a/NEWS b/NEWS index 384fc41c48..ae431fd102 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Jun 2009, PHP 5.2.10 +- Fixed bug #48557 (Numeric string keys in Apache Hashmaps are not cast to + integers). (David Zülke) - Fixed bug #48514 (cURL extension uses same resource name for simple and multi APIs). (Felipe) - Fixed missing erealloc() in fix for Bug #40091 in spl_autoload_register. diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 613a226629..336dbbcc75 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -2726,7 +2726,7 @@ static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data) value = master_to_zval(NULL, xmlValue); if (Z_TYPE_P(key) == IS_STRING) { - zend_hash_update(Z_ARRVAL_P(ret), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(ret), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL); } else if (Z_TYPE_P(key) == IS_LONG) { zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL_P(key), &value, sizeof(zval *), NULL); } else { diff --git a/ext/soap/tests/bug48557.phpt b/ext/soap/tests/bug48557.phpt new file mode 100644 index 0000000000..7d197d4491 --- /dev/null +++ b/ext/soap/tests/bug48557.phpt @@ -0,0 +1,78 @@ +--TEST-- +Bug #48557 (Numeric string keys in Apache Hashmaps are not cast to integers) +--FILE-- +addfunction("test"); +$request = << + + + + + + 1 + 123 + + + -1000 + 123 + + + 2 + 123.5 + + + -2000 + 123.5 + + + 011 + 123.5 + + + 012 + 123.5 + + + + + +XML; + +#$v = array(1 => 123, "2" => 123.5, "asd" => 555); +#var_dump($v);die; +$y->handle($request); + +?> +===DONE=== +--EXPECTF-- +array(6) { + [1]=> + int(123) + [-1000]=> + %string|unicode%(3) "123" + [2]=> + float(123.5) + [-2000]=> + float(123.5) + [%u|b%"011"]=> + float(123.5) + [12]=> + float(123.5) +} +int(123) +float(123.5) diff --git a/ext/soap/tests/bug48557.wsdl b/ext/soap/tests/bug48557.wsdl new file mode 100644 index 0000000000..dfab543c87 --- /dev/null +++ b/ext/soap/tests/bug48557.wsdl @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +