Commit:    485c09a3765b900aea182ddd2dded2286fb0749a
Author:    Dmitry Stogov <dmi...@tpl2.home>         Mon, 3 Sep 2012 11:49:58 
+0400
Parents:   7e816c0921b4fee488d47b8a060ef820a7c46e38
Branches:  PHP-5.3 PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=485c09a3765b900aea182ddd2dded2286fb0749a

Log:
Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice).

Bugs:
https://bugs.php.net/50997

Changed paths:
  M  NEWS
  M  ext/soap/php_encoding.c


Diff:
diff --git a/NEWS b/NEWS
index ae82821..a0e8a68 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,10 @@ PHP                                                          
              NEWS
 - Session:
   . Fixed bug (segfault due to retval is not initialized). (Laruence)
 
+- SOAP
+  . Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a 
choice).
+    (Dmitry)
+
 - SPL:
   . Bug #62987 (Assigning to ArrayObject[null][something] overrides all 
     undefined variables). (Laruence)
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 97a79a3..ee28d99 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -1834,11 +1834,12 @@ static int model_to_xml_object(xmlNodePtr node, 
sdlContentModelPtr model, zval *
 
                        zend_hash_internal_pointer_reset_ex(model->u.content, 
&pos);
                        while (zend_hash_get_current_data_ex(model->u.content, 
(void**)&tmp, &pos) == SUCCESS) {
-                               if (!model_to_xml_object(node, *tmp, object, 
style, (*tmp)->min_occurs > 0 TSRMLS_CC)) {
-                                       if ((*tmp)->min_occurs > 0) {
+                               if (!model_to_xml_object(node, *tmp, object, 
style, strict && ((*tmp)->min_occurs > 0) TSRMLS_CC)) {
+                                       if (!strict || (*tmp)->min_occurs > 0) {
                                                return 0;
                                        }
                                }
+                               strict = 1;
                                zend_hash_move_forward_ex(model->u.content, 
&pos);
                        }
                        return 1;
@@ -1861,7 +1862,7 @@ static int model_to_xml_object(xmlNodePtr node, 
sdlContentModelPtr model, zval *
                        return ret;
                }
                case XSD_CONTENT_GROUP: {
-                       return model_to_xml_object(node, model->u.group->model, 
object, style, model->min_occurs > 0 TSRMLS_CC);
+                       return model_to_xml_object(node, model->u.group->model, 
object, style, strict && model->min_occurs > 0 TSRMLS_CC);
                }
                default:
                  break;


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

Reply via email to