]> granicus.if.org Git - php/commitdiff
Fixed bug #36908 (wsdl default value overrides value in soap request).
authorDmitry Stogov <dmitry@php.net>
Mon, 10 Apr 2006 13:29:48 +0000 (13:29 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 10 Apr 2006 13:29:48 +0000 (13:29 +0000)
NEWS
ext/soap/php_encoding.c
ext/soap/tests/bugs/bug36908.phpt [new file with mode: 0755]
ext/soap/tests/bugs/bug36908.wsdl [new file with mode: 0755]

diff --git a/NEWS b/NEWS
index 17765892aef4741c96bb75415c6a56ffd38019f9..1153767eee9bde5c80473098c3ce2f6e759bd0ae 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,8 @@ PHP                                                                        NEWS
 - Fixed bug #36941 (ArrayIterator does not clone itself). (Marcus)
 - Fixed bug #36934 (OCILob->read() doesn't move internal pointer when 
   reading 0's). (Tony)
+- Fixed bug #36908 (wsdl default value overrides value in soap request).
+  (Dmitry)
 - Fixed bug #36898 (__set() leaks in classes extending internal ones). 
   (Tony, Dmitry)
 - Fixed bug #36886 (User filters can leak buckets in some situations). (Ilia)
index 683e35ef59fe25528e1fd21222d8989e6d86f25a..a4dfb012ab759c665a93077952834d0ba488d34b 100644 (file)
@@ -1128,11 +1128,13 @@ static void model_to_zval_object(zval *ret, sdlContentModelPtr model, xmlNodePtr
 {
        switch (model->kind) {
                case XSD_CONTENT_ELEMENT:
-                 if (model->u.element->name) {
-                       xmlNodePtr node = get_node(data->children, model->u.element->name);
-                       if (node) {
-                               zval *val;
+                       if (model->u.element->name) {
+                               xmlNodePtr node = get_node(data->children, model->u.element->name);
 
+                               if (node) {
+                                       zval *val;
+
+                                       node = check_and_resolve_href(node);
                                        if (node && node->children && node->children->content) {
                                                if (model->u.element->fixed && strcmp(model->u.element->fixed,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);
diff --git a/ext/soap/tests/bugs/bug36908.phpt b/ext/soap/tests/bugs/bug36908.phpt
new file mode 100755 (executable)
index 0000000..cd0ea8b
--- /dev/null
@@ -0,0 +1,46 @@
+--TEST--
+Bug #36908 (wsdl default value overrides value in soap request)
+--SKIPIF--
+<?php 
+  if (!extension_loaded('soap')) die('skip soap extension not available');
+?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+class PublisherService {
+  function add($publisher) {
+    return $publisher->region_id;
+  }
+}
+$input =
+'<?xml version="1.0" encoding="UTF-8"?>
+<soapenv:Envelope
+xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <soapenv:Body>
+    <ns1:add xmlns:ns1="urn:PublisherService" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
+      <publisher href="#id0"/>
+    </ns1:add>
+    <multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:ns3="http://soap.dev/soap/types" id="id0" soapenc:root="0"
+soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+xsi:type="ns3:publisher">
+      <region_id href="#id5"/>
+    </multiRef>
+    <multiRef xmlns:ns5="http://soap.dev/soap/types"
+xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" id="id5"
+soapenc:root="0"
+soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+xsi:type="xsd:long">9</multiRef>
+  </soapenv:Body>
+</soapenv:Envelope>';
+ini_set('soap.wsdl_cache_enabled', false);
+$server = new SoapServer(dirname(__FILE__)."/bug36908.wsdl");
+$server->setClass("PublisherService");
+$server->handle($input);
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:PublisherService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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:addResponse><out xsi:type="xsd:string">9</out></ns1:addResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/bug36908.wsdl b/ext/soap/tests/bugs/bug36908.wsdl
new file mode 100755 (executable)
index 0000000..f3be3f6
--- /dev/null
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>\r
+<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"\r
+xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"\r
+xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"\r
+xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"\r
+xmlns:api="http://soap.dev/soap/PublisherService"\r
+xmlns:types="http://soap.dev/soap/types"\r
+targetNamespace="http://soap.dev/soap/PublisherService">\r
+  <wsdl:types>\r
+    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"\r
+xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"\r
+xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"\r
+xmlns:types="http://soap.dev/soap/types"\r
+targetNamespace="http://soap.dev/soap/types">\r
+      <xsd:complexType name="publisher">\r
+        <xsd:all>\r
+          <xsd:element name="region_id" type="xsd:long" default="52"/>\r
+        </xsd:all>\r
+      </xsd:complexType>\r
+    </xsd:schema> \r
+  </wsdl:types>\r
+  <wsdl:message name="addInput">\r
+    <wsdl:part name="publisher" type="types:publisher"/>\r
+  </wsdl:message>\r
+  <wsdl:message name="addOutput">\r
+    <wsdl:part name="out" type="xsd:string"/>\r
+  </wsdl:message>\r
+  <wsdl:portType name="PublisherServicePortType">\r
+    <wsdl:operation name="add">\r
+      <wsdl:input message="api:addInput"/>\r
+      <wsdl:output message="api:addOutput"/>\r
+    </wsdl:operation>\r
+  </wsdl:portType>\r
+  <wsdl:binding name="PublisherServiceBinding" type="api:PublisherServicePortType">\r
+    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>\r
+    <wsdl:operation name="add">\r
+      <soap:operation soapAction="urn:PublisherService#add" style="rpc"/>\r
+      <wsdl:input>\r
+        <soap:body use="encoded" namespace="urn:PublisherService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+      </wsdl:input>\r
+      <wsdl:output>\r
+        <soap:body use="encoded" namespace="urn:PublisherService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+      </wsdl:output>\r
+    </wsdl:operation>\r
+  </wsdl:binding>\r
+  <wsdl:service name="PublisherService">\r
+    <wsdl:port name="PublisherServicePort" binding="api:PublisherServiceBinding">\r
+      <soap:address location="http://soap.dev/soap//publisher_test.php"/>\r
+    </wsdl:port>\r
+  </wsdl:service>\r
+</wsdl:definitions>\r