ID: 47492
Comment by: niek at signet dot nl
Reported By: florian dot eberle at gmail dot com
Status: Open
Bug Type: SOAP related
Operating System: Debian Lenny
PHP Version: 5.2CVS-2009-02-24 (CVS)
New Comment:
I've the same problem; but I use WSDL with my SOAP.
Previous Comments:
------------------------------------------------------------------------
[2009-02-24 13:33:47] florian dot eberle at gmail dot com
Description:
------------
The Feature SOAP_SINGLE_ELEMENT_ARRAYS has no effect when I try to get
a resultset that sometimes contains only one Object. It always removes
the array and returns the Object without the array.
See Example Code for additional information and feel free to contact me
for additional information.
Reproduce code:
---------------
<?php
$options = array(
'location' => 'http://u8020.intx.ch.netstream.com/dnssoap/soap.cgi'
,
'uri' => 'http://dnstool.netstream.com/DnsAPI' ,
'exceptions' => false ,
'trace' => false ,
'soap_version' => SOAP_1_1 ,
'user_agent' => 'PHP DNS Client' ,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS
);
$soapserver = new SoapClient(null, $options);
//Watch Param type = A here --> array 2 results expected here
$result = $soapserver->__soapCall('GetResourceRecords',
array(new SoapParam('wtf.com', 'zone') , new SoapParam('A',
'type')
));
var_dump($result);
//Watch Param type = MX here --> array with 1 result expected here
$result = $soapserver->__soapCall('GetResourceRecords',
array(new SoapParam('wtf.com', 'zone') , new SoapParam('MX',
'type')
));
var_dump($result);
?>
Expected result:
----------------
array(2) {
["total"]=>
string(1) "2"
["records"]=>
array(2) {
[0]=>
object(stdClass)#4 (7) {
["name"]=>
string(4) "test"
["class"]=>
string(2) "IN"
["data"]=>
string(9) "127.0.0.1"
["id"]=>
string(6) "160441"
["parameter"]=>
string(0) ""
["ttl"]=>
string(0) ""
["type"]=>
string(1) "A"
}
[1]=>
object(stdClass)#5 (7) {
["name"]=>
string(4) "test"
["class"]=>
string(2) "IN"
["data"]=>
string(9) "127.0.0.1"
["id"]=>
string(6) "160442"
["parameter"]=>
string(0) ""
["ttl"]=>
string(0) ""
["type"]=>
string(1) "A"
}
}
}
array(2) {
["total"]=>
string(1) "2"
["records"]=>
array(1) {
[0]=>
object(stdClass)#4 (7) {
["name"]=>
string(4) "stop.bugging.me"
["class"]=>
string(2) "IN"
["data"]=>
string(9) "32"
["id"]=>
string(6) "160443"
["parameter"]=>
string(0) "50"
["ttl"]=>
string(0) "1337"
["type"]=>
string(1) "MX"
}
}
}
Actual result:
--------------
array(2) {
["total"]=>
string(1) "2"
["records"]=>
array(2) {
[0]=>
object(stdClass)#4 (7) {
["name"]=>
string(4) "test"
["class"]=>
string(2) "IN"
["data"]=>
string(9) "127.0.0.1"
["id"]=>
string(6) "160441"
["parameter"]=>
string(0) ""
["ttl"]=>
string(0) ""
["type"]=>
string(1) "A"
}
[1]=>
object(stdClass)#5 (7) {
["name"]=>
string(4) "test"
["class"]=>
string(2) "IN"
["data"]=>
string(9) "127.0.0.1"
["id"]=>
string(6) "160442"
["parameter"]=>
string(0) ""
["ttl"]=>
string(0) ""
["type"]=>
string(1) "A"
}
}
}
array(2) {
["total"]=>
string(1) "1"
["records"]=>
object(stdClass)#6 (7) {
["name"]=>
string(15) "stop.bugging.me"
["class"]=>
string(2) "IN"
["data"]=>
string(2) "32"
["id"]=>
string(6) "160443"
["parameter"]=>
string(2) "50"
["ttl"]=>
string(4) "1337"
["type"]=>
string(2) "MX"
}
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47492&edit=1