From: Felipe Pena Date: Mon, 15 Jun 2009 17:25:28 +0000 (+0000) Subject: - Fixed bug #48557 (Numeric string keys in Apache Hashmaps are not cast to integers... X-Git-Tag: php-5.4.0alpha1~191^2~3317 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f83dcdb0a6b0010b2f6dda7502731ad7fc6913a;p=php - Fixed bug #48557 (Numeric string keys in Apache Hashmaps are not cast to integers) patch by David Zülke --- 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +