#41097 [Opn->Asn]: ext/soap returning associative array as indexed without using WSDL

From: Date: Mon, 16 Apr 2007 07:08:21 +0000
Subject: #41097 [Opn->Asn]: ext/soap returning associative array as indexed without using WSDL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111525@lists.php.net to get a copy of this message
ID: 41097 Updated by: dmitry@php.net Reported By: r dot korving at xit dot nl -Status: Open +Status: Assigned Bug Type: SOAP related Operating System: Debian PHP Version: 5.2.1 -Assigned To: +Assigned To: dmitry Previous Comments: ------------------------------------------------------------------------ [2007-04-16 06:59:17] r dot korving at xit dot nl 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 this bug report at http://bugs.php.net/?id=41097&edit=1

« previous php.bugs (#111525) next »