From: Dmitry Stogov Date: Thu, 1 Apr 2004 10:47:44 +0000 (+0000) Subject: Some small improvments, support for new style constructors, support for exceptions... X-Git-Tag: php-5.0.0RC2RC1~128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=40bb7344525b76d0de051cd59f0f6b6436bd53a4;p=php Some small improvments, support for new style constructors, support for exceptions other then SoapFault --- diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index d3e2b31d19..0fd94bf0ce 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1561,8 +1561,10 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod dims[0] = i; el = &data; for (i = 1; i < dimension; i++) { - if (el != NULL && Z_TYPE_PP(el) == IS_ARRAY && Z_ARRVAL_PP(el)->pListHead) { - el = (zval**)Z_ARRVAL_PP(el)->pListHead->pData; + if (el != NULL && Z_TYPE_PP(el) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_PP(el)) > 0) { + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(el)); + zend_hash_get_current_data(Z_ARRVAL_PP(el), (void**)&el); if (Z_TYPE_PP(el) == IS_ARRAY) { dims[i] = zend_hash_num_elements(Z_ARRVAL_PP(el)); } else { @@ -1627,7 +1629,9 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod if (sdl_type && sdl_type->elements && zend_hash_num_elements(sdl_type->elements) == 1 && - (elementType = *(sdlTypePtr*)sdl_type->elements->pListHead->pData) != NULL && + (zend_hash_internal_pointer_reset(sdl_type->elements), + zend_hash_get_current_data(sdl_type->elements, (void**)&elementType) == SUCCESS) && + (elementType = *(sdlTypePtr*)elementType) != NULL && elementType->encode && elementType->encode->details.type_str) { element_type = elementType; enc = elementType->encode; @@ -1638,7 +1642,9 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod } } else if (sdl_type && sdl_type->elements && zend_hash_num_elements(sdl_type->elements) == 1 && - (elementType = *(sdlTypePtr*)sdl_type->elements->pListHead->pData) != NULL && + (zend_hash_internal_pointer_reset(sdl_type->elements), + zend_hash_get_current_data(sdl_type->elements, (void**)&elementType) == SUCCESS) && + (elementType = *(sdlTypePtr*)elementType) != NULL && elementType->encode && elementType->encode->details.type_str) { element_type = elementType; @@ -1817,13 +1823,17 @@ static zval *to_zval_array(encodeTypePtr type, xmlNodePtr data) dims = get_position_12(dimension, (*ext)->val); if (type->sdl_type && type->sdl_type->elements && zend_hash_num_elements(type->sdl_type->elements) == 1 && - (elementType = *(sdlTypePtr*)type->sdl_type->elements->pListHead->pData) != NULL && + (zend_hash_internal_pointer_reset(type->sdl_type->elements), + zend_hash_get_current_data(type->sdl_type->elements, (void**)&elementType) == SUCCESS) && + (elementType = *(sdlTypePtr*)elementType) != NULL && elementType->encode) { enc = elementType->encode; } } else if (type->sdl_type && type->sdl_type->elements && zend_hash_num_elements(type->sdl_type->elements) == 1 && - (elementType = *(sdlTypePtr*)type->sdl_type->elements->pListHead->pData) != NULL && + (zend_hash_internal_pointer_reset(type->sdl_type->elements), + zend_hash_get_current_data(type->sdl_type->elements, (void**)&elementType) == SUCCESS) && + (elementType = *(sdlTypePtr*)elementType) != NULL && elementType->encode) { enc = elementType->encode; } diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index bc73e31464..a8c07948d6 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -573,7 +573,7 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS cmplen = strlen(content_type); } if (strncmp(content_type, "text/xml", cmplen) == 0 || - strncmp(content_type, "application/soap+xml", cmplen == 0)) { + strncmp(content_type, "application/soap+xml", cmplen) == 0) { /* if (strncmp(http_body, "pListHead->pData; - tmp->refcount++; + zval **tmp; + + zend_hash_internal_pointer_reset(Z_ARRVAL_P(return_value)); + zend_hash_get_current_data(Z_ARRVAL_P(return_value), (void**)&tmp); + (*tmp)->refcount++; zval_dtor(return_value); - *return_value = *tmp; - FREE_ZVAL(tmp); + *return_value = **tmp; + FREE_ZVAL(*tmp); } } diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 70d5f7b3d9..61a0be0fe2 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -1178,7 +1178,7 @@ static void sdl_deserialize_type(sdlTypePtr type, sdlTypePtr *types, encodePtr * WSDL_CACHE_GET_INT(i, in); if (i > 0) { - elements = do_alloca((i+1) * sizeof(sdlTypePtr)); + elements = emalloc((i+1) * sizeof(sdlTypePtr)); elements[0] = NULL; type->elements = emalloc(sizeof(HashTable)); zend_hash_init(type->elements, i, NULL, delete_type, 0); @@ -1212,7 +1212,7 @@ static void sdl_deserialize_type(sdlTypePtr type, sdlTypePtr *types, encodePtr * WSDL_CACHE_SKIP(1, in); } if (elements != NULL) { - free_alloca(elements); + efree(elements); } } @@ -1335,17 +1335,17 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t) close(f); return NULL; } - buf = in = do_alloca(st.st_size); + buf = in = emalloc(st.st_size); if (read(f, in, st.st_size) != st.st_size) { close(f); - free_alloca(in); + efree(in); return NULL; } close(f); if (strncmp(in,"wsdl",4) != 0 || in[4] != WSDL_CACHE_VERSION || in[5] != '\0') { unlink(fn); - free_alloca(buf); + efree(buf); return NULL; } in += 6; @@ -1353,14 +1353,14 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t) WSDL_CACHE_GET(old_t, time_t, &in); if (old_t < t) { unlink(fn); - free_alloca(buf); + efree(buf); return NULL; } WSDL_CACHE_GET_INT(i, &in); if (i == 0 && strncmp(in, uri, i) != 0) { unlink(fn); - free_alloca(buf); + efree(buf); return NULL; } WSDL_CACHE_SKIP(i, &in); @@ -1377,7 +1377,7 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t) WSDL_CACHE_GET_INT(num_encoders, &in); i = num_groups+num_types+num_elements; - types = do_alloca((i+1)*sizeof(sdlTypePtr)); + types = emalloc((i+1)*sizeof(sdlTypePtr)); types[0] = NULL; while (i > 0) { types[i] = emalloc(sizeof(sdlType)); @@ -1390,7 +1390,7 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t) while (enc->details.type != END_KNOWN_TYPES) { i++; enc++; } - encoders = do_alloca((i+1)*sizeof(encodePtr)); + encoders = emalloc((i+1)*sizeof(encodePtr)); i = num_encoders; encoders[0] = NULL; while (i > 0) { @@ -1448,7 +1448,7 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t) /* deserialize bindings */ WSDL_CACHE_GET_INT(num_bindings, &in); - bindings = do_alloca(num_bindings*sizeof(sdlBindingPtr)); + bindings = emalloc(num_bindings*sizeof(sdlBindingPtr)); if (num_bindings > 0) { sdl->bindings = emalloc(sizeof(HashTable)); zend_hash_init(sdl->bindings, num_bindings, NULL, delete_binding, 0); @@ -1475,7 +1475,7 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t) /* deserialize functions */ WSDL_CACHE_GET_INT(num_func, &in); zend_hash_init(&sdl->functions, num_func, NULL, delete_function, 0); - functions = do_alloca(num_func*sizeof(sdlFunctionPtr)); + functions = emalloc(num_func*sizeof(sdlFunctionPtr)); for (i = 0; i < num_func; i++) { int binding_num, num_faults; sdlFunctionPtr func = emalloc(sizeof(sdlFunction)); @@ -1555,11 +1555,11 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t) } } - free_alloca(functions); - free_alloca(bindings); - free_alloca(encoders); - free_alloca(types); - free_alloca(buf); + efree(functions); + efree(bindings); + efree(encoders); + efree(types); + efree(buf); return sdl; } diff --git a/ext/soap/php_soap.dsp b/ext/soap/php_soap.dsp index a80142d6c3..ef0c09f29b 100644 --- a/ext/soap/php_soap.dsp +++ b/ext/soap/php_soap.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 -CFG=php_soap - Win32 Debug +CFG=php_soap - Win32 Debug_TS !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,12 @@ CFG=php_soap - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "php_soap.mak" CFG="php_soap - Win32 Debug" +!MESSAGE NMAKE /f "php_soap.mak" CFG="php_soap - Win32 Debug_TS" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "php_soap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php_soap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php_soap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php_soap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project @@ -29,17 +29,17 @@ CPP=cl.exe MTL=midl.exe RSC=rc.exe -!IF "$(CFG)" == "php_soap - Win32 Release" +!IF "$(CFG)" == "php_soap - Win32 Release_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" +# PROP BASE Output_Dir "Release_TS" +# PROP BASE Intermediate_Dir "Release_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "Release_TS" +# PROP Intermediate_Dir "Release_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /c @@ -53,23 +53,23 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_soap.dll" /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Release_TS" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_soap.dll" /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Release_TS" -!ELSEIF "$(CFG)" == "php_soap - Win32 Debug" +!ELSEIF "$(CFG)" == "php_soap - Win32 Debug_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Output_Dir "Debug_TS" +# PROP BASE Intermediate_Dir "Debug_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Output_Dir "Debug_TS" +# PROP Intermediate_Dir "Debug_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=1 /D "COMPILE_DL_SOAP" /FR"Release_TS/" /Fp"Release_TS/gd.pch" /YX /Fo"Release_TS/" /Fd"Release_TS/" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\..\libxml2-2.4.12\include" /I "..\..\bind" /D "WS" /D "_MBCS" /D "_USRDLL" /D "PHP_SOAP_EXPORTS" /D "WIN32" /D "ZEND_WIN32" /D "PHP_WIN32" /D "ZTS" /D ZEND_DEBUG=1 /D "COMPILE_DL_SOAP" /FR"Debug_TS/" /Fp"Debug_TS/soap.pch" /YX /Fo"Debug_TS/" /Fd"Debug_TS/" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -79,15 +79,15 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_soap.dll" /implib:"Release_TS/php_gd.lib" /pdbtype:sept /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Debug_TS" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib libxml2.lib wsock32.lib resolv.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_soap.dll" /pdbtype:sept /libpath:"..\..\\" /libpath:"..\..\..\libxml2-2.4.12\lib" /libpath:"..\..\Debug_TS" # SUBTRACT LINK32 /pdb:none /incremental:no !ENDIF # Begin Target -# Name "php_soap - Win32 Release" -# Name "php_soap - Win32 Debug" +# Name "php_soap - Win32 Release_TS" +# Name "php_soap - Win32 Debug_TS" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" diff --git a/ext/soap/soap.c b/ext/soap/soap.c index c845ebcf19..0a0289709f 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -609,7 +609,6 @@ PHP_FUNCTION(soap_encode_to_zval) } if (zend_hash_index_find(Z_OBJPROP_P(dom), 1, (void **)&addr) == FAILURE) { - OAP_HEADER_CLASS } node = (xmlNodePtr)Z_LVAL_PP(addr); @@ -1200,8 +1199,7 @@ PHP_METHOD(SoapServer, handle) zval **req_method, **query_string; if (zend_hash_find(Z_ARRVAL_PP(server_vars), "REQUEST_METHOD", sizeof("REQUEST_METHOD"), (void **)&req_method) == SUCCESS) { if (!strcmp(Z_STRVAL_PP(req_method), "GET") && zend_hash_find(Z_ARRVAL_PP(server_vars), "QUERY_STRING", sizeof("QUERY_STRING"), (void **)&query_string) == SUCCESS) { - if (strstr(Z_STRVAL_PP(query_string), "wsdl") != NULL || - strstr(Z_STRVAL_PP(query_string), "WSDL") != NULL) { + if (stricmp(Z_STRVAL_PP(query_string), "wsdl") == 0) { if (service->sdl) { /* char *hdr = emalloc(sizeof("Location: ")+strlen(service->sdl->source)); @@ -1345,7 +1343,9 @@ PHP_METHOD(SoapServer, handle) } /* Find the soap object and assign */ - if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), "_bogus_session_name", sizeof("_bogus_session_name"), (void **) &tmp_soap) == SUCCESS) { + if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), "_bogus_session_name", sizeof("_bogus_session_name"), (void **) &tmp_soap) == SUCCESS && + Z_TYPE_PP(tmp_soap) == IS_OBJECT && + Z_OBJCE_PP(tmp_soap) == service->soap_class.ce) { soap_obj = *tmp_soap; } } @@ -1353,37 +1353,65 @@ PHP_METHOD(SoapServer, handle) /* If new session or something wierd happned */ if (soap_obj == NULL) { zval *tmp_soap; - char *class_name; - int class_name_len; MAKE_STD_ZVAL(tmp_soap); object_init_ex(tmp_soap, service->soap_class.ce); /* Call constructor */ - class_name_len = strlen(service->soap_class.ce->name); - class_name = emalloc(class_name_len+1); - memcpy(class_name, service->soap_class.ce->name,class_name_len+1); - if (zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len+1)) { +#ifdef ZEND_ENGINE_2 + if (zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) { zval c_ret, constructor; INIT_ZVAL(c_ret); INIT_ZVAL(constructor); - ZVAL_STRING(&constructor, service->soap_class.ce->name, 1); + ZVAL_STRING(&constructor, ZEND_CONSTRUCTOR_FUNC_NAME, 1); if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) { php_error(E_ERROR, "Error calling constructor"); } -#ifdef ZEND_ENGINE_2 - if (EG(exception) && - Z_TYPE_P(EG(exception)) == IS_OBJECT && - Z_OBJCE_P(EG(exception)) == soap_fault_class_entry) { - soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC); + if (EG(exception)) { + if (Z_TYPE_P(EG(exception)) == IS_OBJECT && + Z_OBJCE_P(EG(exception)) == soap_fault_class_entry) { + soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC); + } else { + zend_exception_error(EG(exception) TSRMLS_CC); + } } -#endif zval_dtor(&constructor); zval_dtor(&c_ret); + } else { +#else + { +#endif + int class_name_len = strlen(service->soap_class.ce->name); + char *class_name = emalloc(class_name_len+1); + + memcpy(class_name, service->soap_class.ce->name,class_name_len+1); + if (zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len+1)) { + zval c_ret, constructor; + + INIT_ZVAL(c_ret); + INIT_ZVAL(constructor); + + ZVAL_STRING(&constructor, service->soap_class.ce->name, 1); + if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) { + php_error(E_ERROR, "Error calling constructor"); + } +#ifdef ZEND_ENGINE_2 + if (EG(exception)) { + if (Z_TYPE_P(EG(exception)) == IS_OBJECT && + Z_OBJCE_P(EG(exception)) == soap_fault_class_entry) { + soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC); + } else { + zend_exception_error(EG(exception) TSRMLS_CC); + } + } +#endif + zval_dtor(&constructor); + zval_dtor(&c_ret); + } + efree(class_name); } - efree(class_name); #if HAVE_PHP_SESSION /* If session then update session hash with new object */ if (service->soap_class.persistance == SOAP_PERSISTENCE_SESSION) { @@ -1446,16 +1474,19 @@ PHP_METHOD(SoapServer, handle) } soap_server_fault_ex(function, &h->retval, h TSRMLS_CC); #ifdef ZEND_ENGINE_2 - } else if (EG(exception) && - Z_TYPE_P(EG(exception)) == IS_OBJECT && - Z_OBJCE_P(EG(exception)) == soap_fault_class_entry) { - zval *headerfault = NULL, **tmp; - - if (zend_hash_find(Z_OBJPROP_P(EG(exception)), "headerfault", sizeof("headerfault"), (void**)&tmp) == SUCCESS && - Z_TYPE_PP(tmp) != IS_NULL) { - headerfault = *tmp; - } - soap_server_fault_ex(function, EG(exception), h TSRMLS_CC); + } else if (EG(exception)) { + if (Z_TYPE_P(EG(exception)) == IS_OBJECT && + Z_OBJCE_P(EG(exception)) == soap_fault_class_entry) { + zval *headerfault = NULL, **tmp; + + if (zend_hash_find(Z_OBJPROP_P(EG(exception)), "headerfault", sizeof("headerfault"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) != IS_NULL) { + headerfault = *tmp; + } + soap_server_fault_ex(function, EG(exception), h TSRMLS_CC); + } else { + zend_exception_error(EG(exception) TSRMLS_CC); + } #endif } } else if (h->mustUnderstand) { @@ -1469,9 +1500,11 @@ PHP_METHOD(SoapServer, handle) if (zend_hash_exists(function_table, php_strtolower(fn_name, Z_STRLEN(function_name)), Z_STRLEN(function_name) + 1)) { if (service->type == SOAP_CLASS) { call_status = call_user_function(NULL, &soap_obj, &function_name, &retval, num_params, params TSRMLS_CC); +#if HAVE_PHP_SESSION if (service->soap_class.persistance != SOAP_PERSISTENCE_SESSION) { zval_ptr_dtor(&soap_obj); } +#endif } else { call_status = call_user_function(EG(function_table), NULL, &function_name, &retval, num_params, params TSRMLS_CC); } @@ -1481,10 +1514,13 @@ PHP_METHOD(SoapServer, handle) efree(fn_name); #ifdef ZEND_ENGINE_2 - if (EG(exception) && - Z_TYPE_P(EG(exception)) == IS_OBJECT && - Z_OBJCE_P(EG(exception)) == soap_fault_class_entry) { - soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC); + if (EG(exception)) { + if (Z_TYPE_P(EG(exception)) == IS_OBJECT && + Z_OBJCE_P(EG(exception)) == soap_fault_class_entry) { + soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC); + } else { + zend_exception_error(EG(exception) TSRMLS_CC); + } } #endif if (call_status == SUCCESS) { @@ -2836,7 +2872,9 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } else if (function && function->faults && zend_hash_num_elements(function->faults) == 1) { - fault = *(sdlFaultPtr*)function->faults->pListHead->pData; + zend_hash_internal_pointer_reset(function->faults); + zend_hash_get_current_data(function->faults, (void**)&fault); + fault = *(sdlFaultPtr*)fault; if (function->binding && function->binding->bindingType == BINDING_SOAP && fault->bindingAttributes) { @@ -2903,7 +2941,9 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function node = xmlNewNode(NULL, detail_name); xmlAddChild(param, node); - sparam = *(sdlParamPtr*)fault->details->pListHead->pData; + zend_hash_internal_pointer_reset(fault->details); + zend_hash_get_current_data(fault->details, (void**)&sparam); + sparam = *(sdlParamPtr*)sparam; x = serialize_parameter(sparam, detail, 1, NULL, use, node TSRMLS_CC); if (function && @@ -3410,7 +3450,8 @@ static void function_to_string(sdlFunctionPtr function, smart_str *buf) if (function->responseParameters && zend_hash_num_elements(function->responseParameters) > 0) { if (zend_hash_num_elements(function->responseParameters) == 1) { - param = function->responseParameters->pListHead->pData; + zend_hash_internal_pointer_reset(function->responseParameters); + zend_hash_get_current_data(function->responseParameters, (void**)¶m); if ((*param)->encode && (*param)->encode->details.type_str) { smart_str_appendl(buf, (*param)->encode->details.type_str, strlen((*param)->encode->details.type_str)); smart_str_appendc(buf, ' '); @@ -3553,7 +3594,9 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) smart_str_appendc(buf, ' '); } else if (type->elements && zend_hash_num_elements(type->elements) == 1 && - (elementType = *(sdlTypePtr*)type->elements->pListHead->pData) != NULL && + (zend_hash_internal_pointer_reset(type->elements), + zend_hash_get_current_data(type->elements, (void**)&elementType) == SUCCESS) && + (elementType = *(sdlTypePtr*)elementType) != NULL && elementType->encode && elementType->encode->details.type_str) { smart_str_appends(buf, elementType->encode->details.type_str); smart_str_appendc(buf, ' ');