From: Dmitry Stogov Date: Mon, 9 Aug 2004 05:50:06 +0000 (+0000) Subject: Included ext/soap fixes from CVS HEAD. X-Git-Tag: php-5.0.1RC1~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=836a7b1a889f5b98aa1a5f4876528c0c60322e8a;p=php Included ext/soap fixes from CVS HEAD. --- diff --git a/NEWS b/NEWS index 010b29a6dd..8583c7ae72 100644 --- 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) diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 9865e02cdc..d8518cb298 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -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); diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 1472658121..604e1062a5 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -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, ¶m 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] = ¶m1; - 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] = ¶m2; - 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] = ¶m3; 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 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); }