dmitry          Thu Oct 16 15:37:11 2008 UTC

  Modified files:              
    /php-src/ext/soap   php_encoding.c 
  Log:
  Fixed bug #43723 (SOAP not sent properly from client for <choice>)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.169&r2=1.170&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.169 
php-src/ext/soap/php_encoding.c:1.170
--- php-src/ext/soap/php_encoding.c:1.169       Wed Oct  1 08:43:21 2008
+++ php-src/ext/soap/php_encoding.c     Thu Oct 16 15:37:11 2008
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_encoding.c,v 1.169 2008/10/01 08:43:21 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.170 2008/10/16 15:37:11 dmitry Exp $ */
 
 #include <time.h>
 
@@ -362,6 +362,7 @@
 static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, 
xmlNodePtr parent, int use_class_map)
 {
        xmlNodePtr node = NULL;
+       int add_type = 0;
        TSRMLS_FETCH();
 
        /* Special handling of class SoapVar */
@@ -478,14 +479,15 @@
                                            /* TODO: namespace isn't stored */
                                            if (SOAP_GLOBAL(sdl)) {
                                                enc = 
get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name.s);
+                                               if (!enc) {
+                                                               enc = 
find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name.s);
+                                                       }
                                            }
                                        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.s);
-                                                       if (enc) {
-                                                               encode = enc;
-                                                       }
                                                }
                                                efree(type_name.v);
                                        break;
@@ -514,6 +516,9 @@
                }
                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;
@@ -1594,6 +1599,13 @@
                        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) &&



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

Reply via email to