From 8f83dcdb0a6b0010b2f6dda7502731ad7fc6913a Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 15 Jun 2009 17:25:28 +0000 Subject: [PATCH] =?utf8?q?-=20Fixed=20bug=20#48557=20(Numeric=20string=20k?= =?utf8?q?eys=20in=20Apache=20Hashmaps=20are=20not=20cast=20to=20integers)?= =?utf8?q?=20patch=20by=20David=20Z=C3=83=C2=BClke=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ext/soap/php_encoding.c | 2 +- ext/soap/tests/bug48557.phpt | 78 ++++++++++++++++++++++++++++++++++++ ext/soap/tests/bug48557.wsdl | 31 ++++++++++++++ 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 ext/soap/tests/bug48557.phpt create mode 100644 ext/soap/tests/bug48557.wsdl diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 923074674b..088f513098 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -2782,7 +2782,7 @@ static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data) value = master_to_zval(NULL, xmlValue); if (Z_TYPE_P(key) == IS_STRING || Z_TYPE_P(key) == IS_UNICODE) { - zend_u_hash_update(Z_ARRVAL_P(ret), Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_P(key) + 1, &value, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(ret), Z_TYPE_P(key), Z_UNIVAL_P(key), Z_UNILEN_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.50.1