From: Dmitry Stogov Date: Wed, 2 May 2007 09:38:22 +0000 (+0000) Subject: Fixed bug #41004 (minOccurs="0" and null class member variable) X-Git-Tag: RELEASE_1_2_0~184 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d01f873cb667ade3836b6b4e6a0dcceb61952551;p=php Fixed bug #41004 (minOccurs="0" and null class member variable) --- diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 7386ccca21..9f5d1d1585 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1563,6 +1563,8 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval * 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 && diff --git a/ext/soap/tests/bugs/bug41004.phpt b/ext/soap/tests/bugs/bug41004.phpt new file mode 100755 index 0000000000..5f359d9a6f --- /dev/null +++ b/ext/soap/tests/bugs/bug41004.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #41004 minOccurs="0" and null class member variable +--SKIPIF-- + +--FILE-- +'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-- + +REV diff --git a/ext/soap/tests/bugs/bug41004.wsdl b/ext/soap/tests/bugs/bug41004.wsdl new file mode 100755 index 0000000000..d683e5d4ac --- /dev/null +++ b/ext/soap/tests/bugs/bug41004.wsdl @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +