]> granicus.if.org Git - php/commitdiff
Included ext/soap fixes from CVS HEAD.
authorDmitry Stogov <dmitry@php.net>
Mon, 9 Aug 2004 05:50:06 +0000 (05:50 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 9 Aug 2004 05:50:06 +0000 (05:50 +0000)
NEWS
ext/soap/php_sdl.c
ext/soap/soap.c

diff --git a/NEWS b/NEWS
index 010b29a6dde1b70fd38e2df4a08a696aec8bd1fb..8583c7ae7245c44798b4688b29301e5b3cc46fde 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2004, PHP 5.0.1
+- Fixed bug #29236 (memory error when wsdl-cache is enabled). (Dmitry)
+- Fixed bug #29109 (SoapFault exception: [WSDL] Out of memory). (Dmitry)
+- Fixed bug #29061 (soap extension segfaults). (Dmitry)
+- Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). (Dmitry)
 - Updated several libraries bundled with the windows release which now 
   includes libxml2-2.6.11, libxslt-1.1.7 and iconv-1.9.1. (Rob, Edin)
 - Improved and moved ActiveScript SAPI to PECL.  (Wez)
index 9865e02cdc3949172a3266233c620f25bffde8a3..d8518cb298d8b300f64773db27500248f22cdd81 100644 (file)
@@ -1459,14 +1459,12 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t)
                        binding->name = sdl_deserialize_string(&in);
                        binding->location = sdl_deserialize_string(&in);
                        WSDL_CACHE_GET_1(binding->bindingType,sdlBindingType,&in);
-                       if (binding->bindingType == BINDING_SOAP) {
-                               if (*in != 0) {
-                                 sdlSoapBindingPtr soap_binding = binding->bindingAttributes = emalloc(sizeof(sdlSoapBinding));
-                                       WSDL_CACHE_GET_1(soap_binding->style,sdlEncodingStyle,&in);
-                                       WSDL_CACHE_GET_1(soap_binding->transport,sdlTransport,&in);
-                               } else {
-                                       WSDL_CACHE_SKIP(1,&in);
-                               }
+                       if (binding->bindingType == BINDING_SOAP && *in != 0) {
+                         sdlSoapBindingPtr soap_binding = binding->bindingAttributes = emalloc(sizeof(sdlSoapBinding));
+                               WSDL_CACHE_GET_1(soap_binding->style,sdlEncodingStyle,&in);
+                               WSDL_CACHE_GET_1(soap_binding->transport,sdlTransport,&in);
+                       } else {
+                               WSDL_CACHE_SKIP(1,&in);
                        }
                        bindings[i] = binding;
                }
@@ -1490,18 +1488,16 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t)
                } else {
                        func->binding = bindings[binding_num-1];
                }
-               if (func->binding && func->binding->bindingType == BINDING_SOAP) {
-                       if (*in != 0) {
-                               sdlSoapBindingFunctionPtr binding = func->bindingAttributes = emalloc(sizeof(sdlSoapBindingFunction));
-                               memset(binding, 0, sizeof(sdlSoapBindingFunction));
-                               WSDL_CACHE_GET_1(binding->style,sdlEncodingStyle,&in);
-                               binding->soapAction = sdl_deserialize_string(&in);
-                               sdl_deserialize_soap_body(&binding->input, encoders, types, &in);
-                               sdl_deserialize_soap_body(&binding->output, encoders, types, &in);
-                       } else {
-                               WSDL_CACHE_SKIP(1, &in);
-                               func->bindingAttributes = NULL;
-                       }
+               if (func->binding && func->binding->bindingType == BINDING_SOAP && *in != 0) {
+                       sdlSoapBindingFunctionPtr binding = func->bindingAttributes = emalloc(sizeof(sdlSoapBindingFunction));
+                       memset(binding, 0, sizeof(sdlSoapBindingFunction));
+                       WSDL_CACHE_GET_1(binding->style,sdlEncodingStyle,&in);
+                       binding->soapAction = sdl_deserialize_string(&in);
+                       sdl_deserialize_soap_body(&binding->input, encoders, types, &in);
+                       sdl_deserialize_soap_body(&binding->output, encoders, types, &in);
+               } else {
+                       WSDL_CACHE_SKIP(1, &in);
+                       func->bindingAttributes = NULL;
                }
 
                func->requestParameters = sdl_deserialize_parameters(encoders, types, &in);
index 1472658121ec9370d1be18ec92b02413b1182ec4..604e1062a5a1528595d8b69429df117f30cfdb9b 100644 (file)
@@ -1262,7 +1262,7 @@ PHP_METHOD(SoapServer, handle)
                                                INIT_ZVAL(readfile_ret);
                                                MAKE_STD_ZVAL(param);
 
-                                               sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
+                                               sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\"")-1, 1);
                                                ZVAL_STRING(param, service->sdl->source, 1);
                                                ZVAL_STRING(&readfile, "readfile", 1);
                                                if (call_user_function(EG(function_table), NULL, &readfile, &readfile_ret, 1, &param  TSRMLS_CC) == FAILURE) {
@@ -1623,11 +1623,11 @@ PHP_METHOD(SoapServer, handle)
        }
 
        sprintf(cont_len, "Content-Length: %d", size);
-       sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
+       sapi_add_header(cont_len, strlen(cont_len), 1);
        if (soap_version == SOAP_1_2) {
-               sapi_add_header("Content-Type: application/soap+xml; charset=\"utf-8\"", sizeof("Content-Type: application/soap+xml; charset=\"utf-8\""), 1);
+               sapi_add_header("Content-Type: application/soap+xml; charset=\"utf-8\"", sizeof("Content-Type: application/soap+xml; charset=\"utf-8\"")-1, 1);
        } else {
-               sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
+               sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\"")-1, 1);
        }
 
        xmlFreeDoc(doc_return);
@@ -1707,13 +1707,13 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
           Want to return HTTP 500 but apache wants to over write
           our fault code with their own handling... Figure this out later
        */
-       sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error"), 1);
+       sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1);
        sprintf(cont_len,"Content-Length: %d", size);
-       sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
+       sapi_add_header(cont_len, strlen(cont_len), 1);
        if (soap_version == SOAP_1_2) {
-               sapi_add_header("Content-Type: application/soap+xml; charset=\"utf-8\"", sizeof("Content-Type: application/soap+xml; charset=\"utf-8\""), 1);
+               sapi_add_header("Content-Type: application/soap+xml; charset=\"utf-8\"", sizeof("Content-Type: application/soap+xml; charset=\"utf-8\"")-1, 1);
        } else {
-               sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
+               sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\"")-1, 1);
        }
        php_write(buf, size TSRMLS_CC);
 
@@ -1993,10 +1993,18 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
        ZVAL_STRINGL(params[0], buf, buf_size, 0);
        INIT_ZVAL(param1);
        params[1] = &param1;
-       ZVAL_STRING(params[1], location, 0);
+       if (location == NULL) {
+               ZVAL_NULL(params[1]);
+       } else {
+               ZVAL_STRING(params[1], location, 0);
+       }
        INIT_ZVAL(param2);
        params[2] = &param2;
-       ZVAL_STRING(params[2], action, 0);
+       if (action == NULL) {
+               ZVAL_NULL(params[2]);
+       } else {
+               ZVAL_STRING(params[2], action, 0);
+       }
        INIT_ZVAL(param3);
        params[3] = &param3;
        ZVAL_LONG(params[3], version);
@@ -2035,8 +2043,6 @@ static void do_soap_call(zval* this_ptr,
        sdlPtr old_sdl = NULL;
        sdlFunctionPtr fn;
        xmlDocPtr request = NULL;
-       char *buffer;
-       int len;
        int ret = FALSE;
        int soap_version;
        zval response;
@@ -2603,8 +2609,6 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c
        xmlAttrPtr attr;
        sdlFunctionPtr function;
 
-       ZVAL_EMPTY_STRING(function_name);
-
        /* Get <Envelope> element */
        env = NULL;
        trav = request->children;
@@ -3745,8 +3749,12 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
                case XSD_TYPEKIND_SIMPLE:
                case XSD_TYPEKIND_LIST:
                case XSD_TYPEKIND_UNION:
-                       smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str));
-                       smart_str_appendc(buf, ' ');
+                       if (type->encode) {
+                               smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str));
+                               smart_str_appendc(buf, ' ');
+                       } else {
+                               smart_str_appendl(buf, "anyType ", sizeof("anyType ")-1);
+                       }
                        smart_str_appendl(buf, type->name, strlen(type->name));
                        break;
                case XSD_TYPEKIND_COMPLEX:
@@ -3771,7 +3779,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
                                                len = end-(*ext)->val;
                                        }
                                        if (len == 0) {
-                                               smart_str_appendl(buf, "anyType", 7);
+                                               smart_str_appendl(buf, "anyType", sizeof("anyType")-1);
                                        } else {
                                                smart_str_appendl(buf, (*ext)->val, len);
                                        }