From: Dmitry Stogov Date: Wed, 2 May 2007 09:38:12 +0000 (+0000) Subject: Fixed bug #41004 (minOccurs="0" and null class member variable) X-Git-Tag: php-5.2.2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=101a0f08ce9650b92fdce6560ad994020a3eba76;p=php Fixed bug #41004 (minOccurs="0" and null class member variable) --- diff --git a/NEWS b/NEWS index 776e5be23f..34743af934 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ PHP NEWS - Fixed bug #41215 (setAttribute return code reversed). (Ilia) - Fixed bug #41097 (ext/soap returning associative array as indexed without using WSDL). (Dmitry) +- Fixed bug #41004 (minOccurs="0" and null class member variable). (Dmitry) 26 Apr 2007, PHP 5.2.2RC2 - Added GMP_VERSION constant. (Tony) diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 083b50ae40..6a2c71d583 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1595,6 +1595,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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +