dmitry Wed Nov 8 10:05:33 2006 UTC
Modified files:
/php-src/ext/soap php_encoding.c
/php-src/ext/soap/tests/bugs bug38536.phpt bug38536.wsdl
Log:
Fixed bug #38536 (SOAP returns an array of values instead of an object)
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.145&r2=1.146&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.145
php-src/ext/soap/php_encoding.c:1.146
--- php-src/ext/soap/php_encoding.c:1.145 Mon Oct 23 06:49:49 2006
+++ php-src/ext/soap/php_encoding.c Wed Nov 8 10:05:32 2006
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.c,v 1.145 2006/10/23 06:49:49 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.146 2006/11/08 10:05:32 dmitry Exp $ */
#include <time.h>
@@ -1103,13 +1103,14 @@
if (node) {
zval *val;
+ xmlNodePtr r_node;
- node = check_and_resolve_href(node);
- if (node && node->children &&
node->children->content) {
- if (model->u.element->fixed &&
strcmp(model->u.element->fixed, (char*)node->children->content) != 0) {
- soap_error3(E_ERROR,
"Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)",
model->u.element->name, model->u.element->fixed, node->children->content);
+ r_node = check_and_resolve_href(node);
+ if (r_node && r_node->children &&
r_node->children->content) {
+ if (model->u.element->fixed &&
strcmp(model->u.element->fixed, (char*)r_node->children->content) != 0) {
+ soap_error3(E_ERROR,
"Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)",
model->u.element->name, model->u.element->fixed, r_node->children->content);
}
- val =
master_to_zval(model->u.element->encode, node);
+ val =
master_to_zval(model->u.element->encode, r_node);
} else if (model->u.element->fixed) {
xmlNodePtr dummy =
xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlNodeSetContent(dummy,
BAD_CAST(model->u.element->fixed));
@@ -1121,7 +1122,7 @@
val =
master_to_zval(model->u.element->encode, dummy);
xmlFreeNode(dummy);
} else {
- val =
master_to_zval(model->u.element->encode, node);
+ val =
master_to_zval(model->u.element->encode, r_node);
}
if ((node = get_node(node->next,
model->u.element->name)) != NULL) {
zval *array;
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug38536.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug38536.phpt
diff -u /dev/null php-src/ext/soap/tests/bugs/bug38536.phpt:1.2
--- /dev/null Wed Nov 8 10:05:33 2006
+++ php-src/ext/soap/tests/bugs/bug38536.phpt Wed Nov 8 10:05:33 2006
@@ -0,0 +1,52 @@
+--TEST--
+Bug #38536 (SOAP returns an array of values instead of an object)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+class LocalSoapClient extends SoapClient {
+ function __doRequest($request, $location, $action, $version) {
+ return <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope
+ SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ns1="http://www.grupos.com.br/ws/enturma/client">
+<SOAP-ENV:Body>
+<getClientInfoFromDomainResponse SOAP-ENC:root="1">
+ <xsd:Result xsi:type="ns1:ClientType">
+ <id xsi:type="xsd:int">2</id>
+ <address href="#i2"/>
+ </xsd:Result>
+</getClientInfoFromDomainResponse>
+<xsd:address id="i2" xsi:type="ns1:ClientAddressType" SOAP-ENC:root="0">
+ <idClient xsi:type="xsd:long">2</idClient>
+ <address href="#i3"/>
+</xsd:address>
+<address xsi:type="xsd:string" id="i3" SOAP-ENC:root="0">Test</address>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+EOF;
+ }
+}
+
+ini_set("soap.wsdl_cache_enabled", 0);
+$SOAPObject = new LocalSoapClient(dirname(__FILE__).'/bug38536.wsdl');
+print_r($SOAPObject->test());
+?>
+--EXPECT--
+stdClass Object
+(
+ [id] => 2
+ [address] => stdClass Object
+ (
+ [idClient] => 2
+ [address] => Test
+ )
+
+)
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug38536.wsdl?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug38536.wsdl
diff -u /dev/null php-src/ext/soap/tests/bugs/bug38536.wsdl:1.2
--- /dev/null Wed Nov 8 10:05:33 2006
+++ php-src/ext/soap/tests/bugs/bug38536.wsdl Wed Nov 8 10:05:33 2006
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
+
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+
xmlns:enturma="http://www.grupos.com.br/ws/enturmaServices"
+
xmlns:clientTypes="http://www.grupos.com.br/ws/enturma/client"
+
targetNamespace="http://www.grupos.com.br/ws/enturmaServices"
+ elementFormDefault="qualified"
+ attributeFormDefault="qualified">
+ <types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
+
targetNamespace="http://www.grupos.com.br/ws/enturma/client">
+ <complexType name="ClientType">
+ <sequence>
+ <element name="id" type="int"/>
+ <element name="address"
type="clientTypes:ClientAddressType" minOccurs="0"/>
+ </sequence>
+ </complexType>
+ <complexType name="ClientAddressType">
+ <sequence>
+ <element name="idClient" type="int"/>
+ <element name="address" type="string"
minOccurs="0"/>
+ </sequence>
+ </complexType>
+ </schema>
+ </types>
+ <message name="testMessage" />
+ <message name="testResponse">
+ <part name="domain" type="clientTypes:ClientType"/>
+ </message>
+
+ <portType name="SessionImpl">
+ <operation name="test">
+ <input message="enturma:testMessage" />
+ <output message="enturma:testResponse" />
+ </operation>
+ </portType>
+ <binding name="SessionBind" type="enturma:SessionImpl">
+ <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="test">
+ <soap:operation soapAction="test://"/>
+ <input>
+ <soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="test://"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="test://"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="Session">
+ <port name="SessionImpl" binding="enturma:SessionBind">
+ <soap:address location="test://"/>
+ </port>
+ </service>
+</definitions>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php