From:             e dot mortoray at ecircle dot com
Operating system: Linux
PHP version:      5.2.9
PHP Bug Type:     SOAP related
Bug description:  Array types don't retain xsi:types for polymorphic types

Description:
------------
The SOAPClient doesn't appear to handle Arrays containing polymorphic
types correctly.

In this case (using the Seapine TestTrack API) we have an array of type
"ArrayOfCField" according to the WSDL.  And if we obtain a result the XML
encoding of this array looks like this:

<customFieldList xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="ttns:CField[1]"><item
xsi:type="ttns:CDropdownField"><recordid>363</recordid><name>Customer</name><value>Argos
(C1407)</value></item></customFieldList>

But when using var_dump on the resulting structure we can see that the
"CDropdownField" (which derives from CField) is lost in the stored data.

Subsequently that means when submitting the data back the Array does not
contain the proper types. The resulting XML is this:

<customFieldList SOAP-ENC:arrayType="ns1:CField[1]"
xsi:type="ns1:ArrayOfCField"><item xsi:type="ns1:CField"><recordid
xsi:type="xsd:long">363</recordid><name
xsi:type="xsd:string">Customer</name></item></customFieldList>

Note that the first item is simply of type "CField" rather than
"CDropdownField". Needless to say this causes the server to reject the
request.

Related Bugs: 36575

Reproduce code:
---------------
In the TestTrack API this is simply:

$defect = $soap->editDefect( $cookie, $number, '', false );
$soap->saveDefect( $cookie, $defect );

Docs for the WSDL/API:
http://labs.seapine.com/SDKRequests.php


Expected result:
----------------
The stored data and the returned data should retain the knowledge of the
derived types.  In this case the item in the array should be marked as a
CDropdownField.

It should be noted that if the data obtained is manually patched, then the
return works. That is, setting the "customFieldList" such as:
'customFieldList' => array (
        new SoapVar( array(
                'recordid' => 363,
                'name' => 'Customer',
                'value' => 'Argos (C1407)',
                ), XSD_ANYTYPE, 'CDropdownField', 'urn:testtrack-interface' ))



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

Reply via email to