dmitry          Wed May  2 09:38:22 2007 UTC

  Modified files:              
    /php-src/ext/soap   php_encoding.c 
    /php-src/ext/soap/tests/bugs        bug41004.phpt bug41004.wsdl 
  Log:
  Fixed bug #41004 (minOccurs="0" and null class member variable)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.158&r2=1.159&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.158 
php-src/ext/soap/php_encoding.c:1.159
--- php-src/ext/soap/php_encoding.c:1.158       Wed May  2 08:22:32 2007
+++ php-src/ext/soap/php_encoding.c     Wed May  2 09:38:22 2007
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_encoding.c,v 1.158 2007/05/02 08:22:32 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.159 2007/05/02 09:38:22 dmitry Exp $ */
 
 #include <time.h>
 
@@ -1563,6 +1563,8 @@
                                                property = xmlNewNode(NULL, 
BAD_CAST("BOGUS"));
                                                xmlAddChild(node, property);
                                                set_xsi_nil(property);
+                                       } else if (Z_TYPE_P(data) == IS_NULL && 
model->min_occurs == 0) {
+                                               return 1;
                                        } else {
                                                property = master_to_xml(enc, 
data, style, node);
                                                if (property->children && 
property->children->content &&
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug41004.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug41004.phpt
diff -u /dev/null php-src/ext/soap/tests/bugs/bug41004.phpt:1.2
--- /dev/null   Wed May  2 09:38:22 2007
+++ php-src/ext/soap/tests/bugs/bug41004.phpt   Wed May  2 09:38:22 2007
@@ -0,0 +1,36 @@
+--TEST--
+Bug #41004 minOccurs="0" and null class member variable 
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ini_set('soap.wsdl_cache_enabled', false);
+
+class EchoBean{
+       public $mandatoryElement;
+       public $optionalElement;
+       
+}
+
+class EchoRequest{
+       public $in;
+}
+
+class EchoResponse{
+       public $out;
+}
+
+$wsdl = dirname(__FILE__)."/bug41004.wsdl";
+$classmap = 
array('EchoBean'=>'EchoBean','echo'=>'EchoRequest','echoResponse'=>'EchoResponse');
+$client = new SoapClient($wsdl, array('location'=>'test://',"classmap" => 
$classmap, 'exceptions'=>0, 'trace'=>1));
+$echo=new EchoRequest();
+$in=new EchoBean();
+$in->mandatoryElement="REV";
+$in->optionalElement=NULL;
+$echo->in=$in;
+$client->echo($echo);
+echo $client->__getLastRequest();
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="urn:Formation"><SOAP-ENV:Body><ns1:echo><in><mandatoryElement>REV</mandatoryElement></in></ns1:echo></SOAP-ENV:Body></SOAP-ENV:Envelope>
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug41004.wsdl?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug41004.wsdl
diff -u /dev/null php-src/ext/soap/tests/bugs/bug41004.wsdl:1.2
--- /dev/null   Wed May  2 09:38:22 2007
+++ php-src/ext/soap/tests/bugs/bug41004.wsdl   Wed May  2 09:38:22 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+       xmlns:tns="urn:Formation" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+       xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="Formation"
+       targetNamespace="urn:Formation">
+       <wsdl:types>
+               <xsd:schema targetNamespace="urn:Formation">
+                       <xsd:element name="echo">
+                               <xsd:complexType>
+                                       <xsd:sequence>                          
                <xsd:element name="in" type="tns:EchoBean"></xsd:element>
+                                       </xsd:sequence>
+                               </xsd:complexType>
+                       </xsd:element>
+                       <xsd:element name="echoResponse">
+                               <xsd:complexType>
+                                       <xsd:sequence>
+                                               <xsd:element name="out" 
type="tns:EchoBean"></xsd:element>
+                                       </xsd:sequence>
+                               </xsd:complexType>
+                       </xsd:element>
+                       <xsd:simpleType name="Product1Type">
+                               <xsd:restriction base="xsd:string">
+                                       <xsd:enumeration 
value="REV"></xsd:enumeration>
+                                       <xsd:enumeration 
value="CLA"></xsd:enumeration>
+                               </xsd:restriction>
+                       </xsd:simpleType>
+
+                       <xsd:complexType name="EchoBean">
+                               <xsd:sequence>
+                                       <xsd:element name="mandatoryElement"
+                                               type="tns:Product1Type">
+                                       </xsd:element>
+                                       <xsd:element name="optionalElement"
+                                               type="tns:Product1Type" 
maxOccurs="1" minOccurs="0">
+                                       </xsd:element>
+                               </xsd:sequence>
+                       </xsd:complexType>
+               </xsd:schema>
+       </wsdl:types>
+       <wsdl:message name="echoRequest">
+               <wsdl:part name="parameters" element="tns:echo"></wsdl:part>
+       </wsdl:message>
+       <wsdl:message name="echoResponse">
+               <wsdl:part name="parameters" 
element="tns:echoResponse"></wsdl:part>
+       </wsdl:message>
+       <wsdl:portType name="Formation">
+               <wsdl:operation name="echo">
+                       <wsdl:input message="tns:echoRequest"></wsdl:input>
+                       <wsdl:output message="tns:echoResponse"></wsdl:output>
+               </wsdl:operation>
+       </wsdl:portType>
+       <wsdl:binding name="FormationServiceV1" type="tns:Formation">           
<soap:binding style="document"                  
transport="http://schemas.xmlsoap.org/soap/http"; />             <wsdl:operation 
name="echo">
+                       <soap:operation soapAction="urn:Formation/echo" />
+                       <wsdl:input>
+                               <soap:body use="literal" />
+                       </wsdl:input>
+                       <wsdl:output>
+                               <soap:body use="literal" />
+                       </wsdl:output>
+               </wsdl:operation>
+       </wsdl:binding>
+       <wsdl:service name="Formation">
+               <wsdl:port binding="tns:FormationServiceV1"
+                       name="FormationSOAP">
+                       <soap:address
+                               
location="http://localhost:8080/webapp/services/FormationServiceV1"; />
+               </wsdl:port>
+       </wsdl:service>
+</wsdl:definitions>

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to