php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36575 Incorrect complex type instantiation with hierarchies
Submitted: 2006-03-01 17:55 UTC Modified: 2006-03-03 10:21 UTC
From: hjiverson at plauditdesign dot com Assigned: dmitry
Status: Closed Package: SOAP related
PHP Version: 5.1.2 OS: Gentoo Linux 2.6, Windows XP SP2
Private report: No CVE-ID:
 [2006-03-01 17:55 UTC] hjiverson at plauditdesign dot com
Description:
------------
The client and server always try to instantiate the base XSD type defined in a hierarchy. 

For example: A3 extends A2, A2 extends A1. function returnA2(), which is mapped to return A2 in WSDL, returns an instance of A3 (which is legal, since A3 is an A2). SOAP tries to create an A1, even though it is actually an instance of A3. If A1 is not defined in the class map, SOAP returns an A2, which is also not correct. 

The correct behavior would be (like Axis) to map and return an A3--the exact type the instance is mapped to--as long as it is instanceof A2.

Reproduce code:
---------------
http://dev.plauditdesign.com/~hjiverson/php-soap-bug.txt

Expected result:
----------------
Response:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns1="urn:test.soap#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:ns2="urn:test.soap.types#" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><result 
xsi:type="ns2:A3"><var1 xsi:type="xsd:string">one</var1><var2 
xsi:type="xsd:string">var two</var2><var3 xsi:type="xsd:string">var 
three</var3></result></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>


Actual result:
--------------
Response:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Cannot instantiate abstract class CT_A1</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-03 10:21 UTC] dmitry@php.net
Dixed in CVS HEAD and PHP_5_1.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 25 07:02:14 2014 UTC