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 &&
--- /dev/null
+--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>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"\r
+ xmlns:tns="urn:Formation" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"\r
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Formation"\r
+ targetNamespace="urn:Formation">\r
+ <wsdl:types>\r
+ <xsd:schema targetNamespace="urn:Formation">\r
+ <xsd:element name="echo">\r
+ <xsd:complexType>\r
+ <xsd:sequence>\r <xsd:element name="in" type="tns:EchoBean"></xsd:element>
+ </xsd:sequence>\r
+ </xsd:complexType>\r
+ </xsd:element>
+ <xsd:element name="echoResponse">
+ <xsd:complexType>
+ <xsd:sequence>\r
+ <xsd:element name="out" type="tns:EchoBean"></xsd:element>
+ </xsd:sequence>\r
+ </xsd:complexType>\r
+ </xsd:element>
+ <xsd:simpleType name="Product1Type">\r
+ <xsd:restriction base="xsd:string">\r
+ <xsd:enumeration value="REV"></xsd:enumeration>\r
+ <xsd:enumeration value="CLA"></xsd:enumeration>\r
+ </xsd:restriction>\r
+ </xsd:simpleType>\r
+\r
+ <xsd:complexType name="EchoBean">
+ <xsd:sequence>
+ <xsd:element name="mandatoryElement"\r
+ type="tns:Product1Type">
+ </xsd:element>\r
+ <xsd:element name="optionalElement"\r
+ type="tns:Product1Type" maxOccurs="1" minOccurs="0">\r
+ </xsd:element>
+ </xsd:sequence>\r
+ </xsd:complexType>
+ </xsd:schema>\r
+ </wsdl:types>\r
+ <wsdl:message name="echoRequest">\r
+ <wsdl:part name="parameters" element="tns:echo"></wsdl:part>\r
+ </wsdl:message>
+ <wsdl:message name="echoResponse">
+ <wsdl:part name="parameters" element="tns:echoResponse"></wsdl:part>\r
+ </wsdl:message>
+ <wsdl:portType name="Formation">\r
+ <wsdl:operation name="echo">\r
+ <wsdl:input message="tns:echoRequest"></wsdl:input>
+ <wsdl:output message="tns:echoResponse"></wsdl:output>\r
+ </wsdl:operation>
+ </wsdl:portType>\r
+ <wsdl:binding name="FormationServiceV1" type="tns:Formation">\r <soap:binding style="document"\r transport="http://schemas.xmlsoap.org/soap/http" />\r <wsdl:operation name="echo">\r
+ <soap:operation soapAction="urn:Formation/echo" />
+ <wsdl:input>
+ <soap:body use="literal" />\r
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />\r
+ </wsdl:output>\r
+ </wsdl:operation>
+ </wsdl:binding>\r
+ <wsdl:service name="Formation">\r
+ <wsdl:port binding="tns:FormationServiceV1"\r
+ name="FormationSOAP">\r
+ <soap:address\r
+ location="http://localhost:8080/webapp/services/FormationServiceV1" />\r
+ </wsdl:port>\r
+ </wsdl:service>\r
+</wsdl:definitions>\r