From:             florian dot eberle at gmail dot com
Operating system: Debian Lenny
PHP version:      5.2CVS-2009-02-24 (CVS)
PHP Bug Type:     SOAP related
Bug description:  SOAP_SINGLE_ELEMENT_ARRAYS has no effect

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 bug report at http://bugs.php.net/?id=47492&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47492&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47492&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47492&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47492&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47492&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47492&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47492&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47492&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47492&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47492&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47492&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47492&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47492&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47492&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47492&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47492&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47492&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47492&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47492&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47492&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47492&r=mysqlcfg

Reply via email to