]> granicus.if.org Git - php/commitdiff
Fixed bug #43723 (SOAP not sent properly from client for <choice>)
authorDmitry Stogov <dmitry@php.net>
Thu, 16 Oct 2008 15:36:46 +0000 (15:36 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 16 Oct 2008 15:36:46 +0000 (15:36 +0000)
NEWS
ext/soap/php_encoding.c

diff --git a/NEWS b/NEWS
index 5c20c6dd7f166843187f5f98e9e67a02d9d06721..6164f908180f1ee0d5933e0697bffc33b21e98a5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ PHP                                                                        NEWS
 - Fixed buf #45722 (mb_check_encoding() crashes). (Moriyoshi)
 - Fixed bug #44251, #41125 (PDO + quote() + prepare() can result in segfault).
   (tsteiner at nerdclub dot net)
+- Fixed bug #43723 (SOAP not sent properly from client for <choice>). (Dmitry)
 - Fixed bug #42078 (pg_meta_data mix tables metadata from different schemas).
   (Felipe)
 - Fixed bug #37100 (data is returned truncated with BINARY CURSOR). (Tony)
index 6df653570b9dc8b6c9a75655cf0def8e2fe0ba8a..dc2dcfef2b82122795bc1688b8e42bf7443a66ff 100644 (file)
@@ -360,6 +360,7 @@ static zend_bool soap_check_xml_ref(zval **data, xmlNodePtr node TSRMLS_DC)
 static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xmlNodePtr parent, int check_class_map)
 {
        xmlNodePtr node = NULL;
+       int add_type = 0;
        TSRMLS_FETCH();
 
        /* Special handling of class SoapVar */
@@ -450,14 +451,15 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
                                encodePtr enc = NULL;
                                if (SOAP_GLOBAL(sdl)) {
                                        enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name);
+                                       if (!enc) {
+                                                       enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name);
+                                               }
                                }
                                if (enc) {
+                                       if (encode != enc && style == SOAP_LITERAL) {
+                                                       add_type = 1;                                           
+                                       }
                                        encode = enc;
-                                       } else if (SOAP_GLOBAL(sdl)) {
-                                               enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name);
-                                       if (enc) {
-                                               encode = enc;
-                                       }
                                        }
                                break;
                                }
@@ -484,6 +486,9 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
                }
                if (encode->to_xml) {
                        node = encode->to_xml(&encode->details, data, style, parent);
+                       if (add_type) {
+                               set_ns_and_type(node, &encode->details);
+                       }
                }
        }
        return node;
@@ -1623,6 +1628,13 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *
                        encodePtr enc;
 
                        data = get_zval_property(object, model->u.element->name TSRMLS_CC);
+                       if (data &&
+                           Z_TYPE_P(data) == IS_NULL &&
+                           !model->u.element->nillable &&
+                           model->min_occurs > 0 &&
+                           !strict) {
+                               return 0;
+                       }
                        if (data) {
                                enc = model->u.element->encode;
                                if ((model->max_occurs == -1 || model->max_occurs > 1) &&