mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fixed bug #41097 (ext/soap returning associative array as indexed without using WSDL)
This commit is contained in:
parent
f409fcd02a
commit
3721cb9d8d
4 changed files with 37 additions and 2 deletions
2
NEWS
2
NEWS
|
@ -3,6 +3,8 @@ PHP NEWS
|
||||||
?? Apr 2007, PHP 5.2.3RC3
|
?? Apr 2007, PHP 5.2.3RC3
|
||||||
- Fixed iterator_apply() with a callback using __call(). (Johannes)
|
- Fixed iterator_apply() with a callback using __call(). (Johannes)
|
||||||
- Fixed bug #41215 (setAttribute return code reversed). (Ilia)
|
- Fixed bug #41215 (setAttribute return code reversed). (Ilia)
|
||||||
|
- Fixed bug #41097 (ext/soap returning associative array as indexed without
|
||||||
|
using WSDL). (Dmitry)
|
||||||
|
|
||||||
26 Apr 2007, PHP 5.2.2RC2
|
26 Apr 2007, PHP 5.2.2RC2
|
||||||
- Added GMP_VERSION constant. (Tony)
|
- Added GMP_VERSION constant. (Tony)
|
||||||
|
|
|
@ -3356,8 +3356,12 @@ static int is_map(zval *array)
|
||||||
int i, count = zend_hash_num_elements(Z_ARRVAL_P(array));
|
int i, count = zend_hash_num_elements(Z_ARRVAL_P(array));
|
||||||
|
|
||||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(array));
|
zend_hash_internal_pointer_reset(Z_ARRVAL_P(array));
|
||||||
for (i = 0;i < count;i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (zend_hash_get_current_key_type(Z_ARRVAL_P(array)) == HASH_KEY_IS_STRING) {
|
char *str_index;
|
||||||
|
ulong num_index;
|
||||||
|
|
||||||
|
if (zend_hash_get_current_key(Z_ARRVAL_P(array), &str_index, &num_index, 0) == HASH_KEY_IS_STRING ||
|
||||||
|
num_index != i) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
zend_hash_move_forward(Z_ARRVAL_P(array));
|
zend_hash_move_forward(Z_ARRVAL_P(array));
|
||||||
|
|
|
@ -654,6 +654,8 @@ PHP_MINIT_FUNCTION(soap)
|
||||||
REGISTER_LONG_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT);
|
||||||
|
|
||||||
|
REGISTER_LONG_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT);
|
||||||
|
|
||||||
REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT);
|
||||||
|
|
||||||
|
|
27
ext/soap/tests/bugs/bug41097.phpt
Executable file
27
ext/soap/tests/bugs/bug41097.phpt
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #41097 (ext/soap returning associative array as indexed without using WSDL)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once('skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
function test($soap, $array) {
|
||||||
|
$soap->test($array);
|
||||||
|
echo (strpos($soap->__getLastRequest(), ':Map"') != false)?"Map\n":"Array\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$soap = new SoapClient(null, array('uri' => 'http://uri/', 'location' => 'test://', 'exceptions' => 0, 'trace' => 1));
|
||||||
|
test($soap, array('Foo', 'Bar'));
|
||||||
|
test($soap, array(5 => 'Foo', 10 => 'Bar'));
|
||||||
|
test($soap, array('5' => 'Foo', '10' => 'Bar'));
|
||||||
|
$soap->test(new SoapVar(array('Foo', 'Bar'), APACHE_MAP));
|
||||||
|
echo (strpos($soap->__getLastRequest(), ':Map"') != false)?"Map\n":"Array\n";
|
||||||
|
$soap->test(new SoapVar(array('Foo', 'Bar'), SOAP_ENC_ARRAY));
|
||||||
|
echo (strpos($soap->__getLastRequest(), ':Map"') != false)?"Map\n":"Array\n";
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
Array
|
||||||
|
Map
|
||||||
|
Map
|
||||||
|
Map
|
||||||
|
Array
|
Loading…
Add table
Add a link
Reference in a new issue