From 51781931e25b39bd4c9ca401596c0391d6132a5c Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 15 Jun 2009 17:36:00 +0000 Subject: [PATCH] =?utf8?q?-=20MFH:=20Fixed=20bug=20#48557=20(Numeric=20str?= =?utf8?q?ing=20keys=20in=20Apache=20Hashmaps=20are=20not=20cast=20to=20in?= =?utf8?q?tegers)=20patch=20by=20David=20Z=C3=83=C2=BClke=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- NEWS | 2 + ext/soap/php_encoding.c | 2 +- ext/soap/tests/bug48557.phpt | 78 ++++++++++++++++++++++++++++++++++++ ext/soap/tests/bug48557.wsdl | 31 ++++++++++++++ 4 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 ext/soap/tests/bug48557.phpt create mode 100644 ext/soap/tests/bug48557.wsdl 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.40.0