From: sos at sokhapkin dot dyndns dot org
Operating system: Gentoo linux
PHP version: 5.1.6
PHP Bug Type: SOAP related
Bug description: Incorrect return array handling in non-wsdl soap client.
Description:
------------
Return soap type array needs special handling in non-wsdl mode. The return
array should have numeric indexes only because all elements of returned
array have the same name.
Here is the pacth to fix the problem:
--- php_packet_soap.c.orig 2006-01-01 07:50:13.000000000 -0500
+++ php_packet_soap.c 2006-10-10 17:50:50.000000000 -0400
@@ -338,9 +338,18 @@
if (val != NULL) {
if
(!node_is_equal_ex(val,"result",RPC_SOAP12_NAMESPACE)) {
zval *tmp;
+ int isarray = 0;
+ if(xmlHasProp(val,
"type")) {
+ xmlChar *type;
+ type =
xmlGetProp(val, "type");
+ if(strstr(type,
":Array"))
+ isarray =
1;
+ xmlFree(type);
+ }
+
tmp = master_to_zval(NULL,
val);
- if (val->name) {
+ if (val->name && !isarray)
{
add_assoc_zval(return_value, (char*)val->name, tmp);
} else {
add_next_index_zval(return_value, tmp);
Reproduce code:
---------------
Here is an example of soap return xml:
<soapenc:Array soapenc:arrayType="xsd:anyType[4]"
xsi:type="soapenc:Array"><item xsi:type="xsd:long">17326080650</item><item
xsi:type="xsd:int">1</item><item xsi:type="xsd:float">1.99</item><item
xsi:type="xsd:int">0</item></soapenc:Array><soapenc:Array
soapenc:arrayType="xsd:anyType[4]" xsi:type="soapenc:Array"><item
xsi:type="xsd:long">17325882599</item><item
xsi:type="xsd:int">1</item><item xsi:type="xsd:float">1.99</item><item
xsi:type="xsd:int">0</item></soapenc:Array>
Expected result:
----------------
Array => (
[0] => Array => (
[0] => 17326080650
[1] => 1
[2] => 1.99
[3] => 0
)
[1] => Array => (
[0] => 17325882599
[1] => 1
[2] => 1.99
[3] => 0
)
)
Actual result:
--------------
Array => (
[Array] => Array => (
[0] => 17325882599
[1] => 1
[2] => 1.99
[3] => 0
)
)
--
Edit bug report at http://bugs.php.net/?id=39121&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39121&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39121&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39121&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39121&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39121&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39121&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39121&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39121&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39121&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39121&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39121&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39121&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39121&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39121&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39121&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39121&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39121&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39121&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39121&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39121&r=mysqlcfg