#41097 [NEW]: ext/soap returning associative array as indexed without using WSDL

From: Date: Mon, 16 Apr 2007 06:59:17 +0000
Subject: #41097 [NEW]: ext/soap returning associative array as indexed without using WSDL
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111524@lists.php.net to get a copy of this message
From: r dot korving at xit dot nl Operating system: Debian PHP version: 5.2.1 PHP Bug Type: SOAP related Bug description: ext/soap returning associative array as indexed without using WSDL Description: ------------ Returning array('5' => 'Foo', '10' => 'Bar') from a SoapServer handler class ends up as array(0 => 'Foo', 1 => 'Bar') at the client end. But array('a' => 'Foo', 'b' => 'Bar') does end up correctly. It only fails with numeric keys. I'm not using WSDL in this case. I think integer keys that are not in a simple 0..n range should end up in an associative array, not indexed with new 0..n keys. Reproduce code: --------------- <?php class MyHandler { public function getData() { return array('5' => 'Foo', '10' => 'Bar'); } } // initialize soap-server: $soap = new SoapServer(null, array('uri' => 'http://uri/', 'encoding' => 'ISO-8859-1')); $soap->setClass('MyHandler'); $soap->handle(); ?> Expected result: ---------------- array('5' => 'Foo', '10' => 'Bar') Actual result: -------------- array(0 => 'Foo', 1 => 'Bar') -- Edit bug report at http://bugs.php.net/?id=41097&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41097&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41097&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41097&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41097&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41097&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41097&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41097&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41097&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41097&r=support Expected behavior: http://bugs.php.net/fix.php?id=41097&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41097&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41097&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41097&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41097&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41097&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41097&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41097&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41097&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41097&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41097&r=mysqlcfg

« previous php.bugs (#111524) next »