Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.14.0

Bug #1312 bad XML parsing with nested arrays
Submitted: 2004-04-29 10:31 UTC
From: eric dot citaire at laposte dot net Assigned:
Status: Open Package: SOAP
PHP Version: 4.3.4 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 7 + 25 = ?

 
 [2004-04-29 10:31 UTC] eric dot citaire at laposte dot net
Description: ------------ When sending a nested array to a PEAR::SOAP WebService, some elments are objects, not arrays. Reproduce code: --------------- My PHP code: <?php // ... // here is the method declaration: $this->__typedef['{urn:something}Array'] = array(array('item'=>'anyType')); $this->__dispatch_map['test'] = array('in'=>array('anArray'=>'{urn:something}Array')); // ... ?> The XML code the client send: <?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body xmlns:ns1="urn:something"><ns1:test SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><anArray soapenc:arrayType="xsd:anyType[4]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:Array"><item soapenc:arrayType="xsd:string[0]" xsi:type="soapenc:Array" /><item soapenc:arrayType="xsd:double[4]" xsi:type="soapenc:Array"><item xsi:type="xsd:double">1</item><item xsi:type="xsd:double">5</item><item xsi:type="xsd:double">0</item><item xsi:type="xsd:double">6</item></item><item soapenc:arrayType="xsd:double[][3]" xsi:type="soapenc:Array"><item soapenc:arrayType="xsd:double[3]" xsi:type="soapenc:Array"><item xsi:type="xsd:double">8</item><item xsi:type="xsd:double">9</item><item xsi:type="xsd:double">1</item></item><item soapenc:arrayType="xsd:double[0]" xsi:type="soapenc:Array" /><item soapenc:arrayType="xsd:double[6]" xsi:type="soapenc:Array"><item xsi:type="xsd:double">5</item><item xsi:type="xsd:double">7</item><item xsi:type="xsd:double">654</item><item xsi:type="xsd:double">8</item><item xsi:type="xsd:double">1</item><item xsi:type="xsd:double">32</item></item></item><item soapenc:arrayType="xsd:double[2]" xsi:type="soapenc:Array"><item xsi:type="xsd:double">54</item><item xsi:type="xsd:double">57</item></item></anArray></ns1:test></SOAP-ENV:Body></SOAP-ENV:Envelope> Expected result: ---------------- array(4) { [0]=> string(0) "" [1]=> array(4) { [0]=> float(1) [1]=> float(5) [2]=> float(0) [3]=> float(6) } [2]=> array(3) { [0]=> array(3) { [0]=> float(8) [1]=> float(9) [2]=> float(1) } [1]=> float(0) [2]=> array(6) { [0]=> float(5) [1]=> float(7) [2]=> float(654) [3]=> float(8) [4]=> float(1) [5]=> float(32) } } [3]=> array(2) { [0]=> float(54) [1]=> float(57) } } Actual result: -------------- array(1) { ["anArray"]=> array(4) { [0]=> string(0) "" [1]=> array(4) { [0]=> float(1) [1]=> float(5) [2]=> float(0) [3]=> float(6) } [2]=> object(stdClass)(1) { ["item"]=> array(5) { [0]=> float(8) [1]=> float(9) [2]=> float(1) [3]=> string(0) "" [4]=> array(6) { [0]=> float(5) [1]=> float(7) [2]=> float(654) [3]=> float(8) [4]=> float(1) [5]=> float(32) } } } [3]=> array(2) { [0]=> float(54) [1]=> float(57) } } }

Comments

 [2004-04-29 11:47 UTC] eric dot citaire at laposte dot net
Otherwise, the expected result should contain an empty array at index 0, but it contain a string which does not correspond to <item soapenc:arrayType="xsd:string[0]" xsi:type="soapenc:Array" />.
 [2004-05-14 18:38 UTC] superfes at cox dot net
Was running into an issue not too different from this one from the sound of it. I was loading an WSDL file and parsing it, but the complexType that it was supposed to assigning was being overwritten by a default value of Array, every time it would try to create the envelope to send out, the expected result would always fail saying that the data type doesn't exist, because it was looking for the complexType instead. Anyway, here's my diff of the 8.0-RC3 (I removed the comments that were stopping the code from leaving the complexType alone): diff ./WSDL.php /usr/lib/php/SOAP/WSDL.php 1070c1070 < #if (!array_key_exists('type',$this->wsdl->complexTypes[$this->schema][$this->currentComplexType])) { --- > if (!array_key_exists('type',$this->wsdl->complexTypes[$this->schema][$this->currentComplexType])) { 1072c1072 < #} --- > }
 [2006-04-24 21:13 UTC] arnaud (Arnaud Limbourg)
Can you please have a look and mark this bug appropriately, thank you
 [2008-04-06 09:36 UTC] doconnor (Daniel O'Connor)
Unfortunately, I think we'll need a bit more of a reduced test case to track this one down.
 [2008-07-04 22:49 UTC] yunosh (Jan Schneider)
A unit test has been added to CVS.
 [2008-08-03 09:49 UTC] cweiske (Christian Weiske)
Adding test to cvs. The described problem does not occur with the latest cvs version.
 [2008-08-04 08:01 UTC] yunosh (Jan Schneider)
I don't know why you added another test when I already mentioned in my comment directly above yours that I already added one. I also don't know why you are adding PHPUnit tests if the current testing framework for SOAP is obviously PHPT. Finally, I don't know why your test is not failing, but mine is, so either of our tests is wrong.