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

Bug #11057 Cannot add array type attribute to SOAP_Value object
Submitted: 2007-05-16 13:55 UTC
From: leonvandaal Assigned: doconnor
Status: Closed Package: SOAP (version 0.10.1)
PHP Version: 5.0.4 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2007-05-16 13:55 UTC] leonvandaal (Leon Van Daal)
Description: ------------ If I try to manually return a SOAP_Value object where the attributes contains (for example) the following: "SOAP-ENC:arrayType" => "xsd:int[3]" Then the resulting XML will show: <result SOAP-ENC:arrayType="xsd:int"> While I would expect it to return: <result SOAP-ENC:arrayType="xsd:int[3]"> If I comment out the following code found in Base.php(1242) everything works as expected. ---------------------------- // A little more magic than should be in a qname. $p = strpos($this->name, '['); if ($p) { // TODO: Need to re-examine this logic later. // Chop off []. $this->arraySize = explode(',', substr($this->name, $p + 1, -$p - 2)); $this->arrayInfo = substr($this->name, $p); $this->name = substr($this->name, 0, $p); } ---------------------------- Could you please reexamine this TODO, because it seems to cause a bug. Test script: --------------- <?php require_once('SOAP/Base.php'); require_once('SOAP/Value.php'); $values = new SOAP_Value("result", false, array( new SOAP_Value("Item", false, 1), new SOAP_Value("Item", false, 2), new SOAP_Value("Item", false, 3) ), array( "SOAP-ENC:arrayType" => "xsd:int[3]" )); $base = new SOAP_Base(); echo $base->_serializeValue($values, 'Example'); ?> Expected result: ---------------- <Example> <result SOAP-ENC:arrayType="xsd:int[3]"> <Item xsi:type="xsd:int">1</Item> <Item xsi:type="xsd:int">2</Item> <Item xsi:type="xsd:int">3</Item></result></Example> Actual result: -------------- <Example> <result SOAP-ENC:arrayType="xsd:int"> <Item xsi:type="xsd:int">1</Item> <Item xsi:type="xsd:int">2</Item> <Item xsi:type="xsd:int">3</Item></result></Example>

Comments

 [2008-07-12 18:15 UTC] doconnor (Daniel O'Connor)
With 0.11 I get: <Example> <result xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:anyType[3]" SOAP-ENC:offset="[0]" SOAP-ENC:arrayType="xsd:int"> <Item xsi:type="xsd:int">1</Item> <Item xsi:type="xsd:int">2</Item> <Item xsi:type="xsd:int">3</Item></result></Example> ... which looks correct-ish. Can you try with a newer version of the package?
 [2008-08-02 15:49 UTC] doconnor (Daniel O'Connor)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/SOAP Closing 'cause it looks fixed in 0.11