diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 0184eab7bb3c8..c7abcbbd08ef9 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1051,6 +1051,7 @@ PHP_METHOD(SoapServer, addFunction) key = zend_string_tolower(Z_STR_P(tmp_function)); if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { + zend_string_release_ex(key, false); zend_type_error("SoapServer::addFunction(): Function \"%s\" not found", Z_STRVAL_P(tmp_function)); SOAP_SERVER_END_CODE(); RETURN_THROWS(); @@ -1069,6 +1070,7 @@ PHP_METHOD(SoapServer, addFunction) key = zend_string_tolower(Z_STR_P(function_name)); if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { + zend_string_release_ex(key, false); zend_argument_type_error(1, "must be a valid function name, function \"%s\" not found", Z_STRVAL_P(function_name)); SOAP_SERVER_END_CODE(); RETURN_THROWS(); @@ -1395,8 +1397,7 @@ PHP_METHOD(SoapServer, handle) } } #endif - zend_string *fn_name = zend_string_tolower(Z_STR(h->function_name)); - if (zend_hash_exists(function_table, fn_name) || + if (zend_hash_find_ptr_lc(function_table, Z_STR(h->function_name)) != NULL || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) { @@ -1412,25 +1413,21 @@ PHP_METHOD(SoapServer, handle) instanceof_function(Z_OBJCE(h->retval), soap_fault_class_entry)) { php_output_discard(); soap_server_fault_ex(function, &h->retval, h); - zend_string_release(fn_name); if (service->type == SOAP_CLASS && soap_obj) {zval_ptr_dtor(soap_obj);} goto fail; } else if (EG(exception)) { php_output_discard(); _soap_server_exception(service, function, ZEND_THIS); - zend_string_release(fn_name); if (service->type == SOAP_CLASS && soap_obj) {zval_ptr_dtor(soap_obj);} goto fail; } } else if (h->mustUnderstand) { soap_server_fault("MustUnderstand","Header not understood", NULL, NULL, NULL); } - zend_string_release(fn_name); } } - zend_string *fn_name = zend_string_tolower(Z_STR(function_name)); - if (zend_hash_exists(function_table, fn_name) || + if (zend_hash_find_ptr_lc(function_table, Z_STR(function_name)) != NULL || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) { @@ -1452,7 +1449,6 @@ PHP_METHOD(SoapServer, handle) } else { php_error(E_ERROR, "Function '%s' doesn't exist", Z_STRVAL(function_name)); } - zend_string_release(fn_name); if (EG(exception)) { if (!zend_is_unwind_exit(EG(exception))) {