[php-src] master: soap: store zend_function pointers in soap_functions.ft field

From: Date: Fri, 02 Oct 2026 18:15:59 +0000
Subject: [php-src] master: soap: store zend_function pointers in soap_functions.ft field
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141891@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Date: 2026-10-02T19:15:43+01:00 Commit: https://github.com/php/php-src/commit/57001e6fd8850479ce3b228a502847980b8a37ff Raw diff: https://github.com/php/php-src/commit/57001e6fd8850479ce3b228a502847980b8a37ff.diff soap: store zend_function pointers in soap_functions.ft field Changed paths: M ext/soap/soap.c Diff: diff --git a/ext/soap/soap.c b/ext/soap/soap.c index a9a7ce8d2057..8c0cff80d908 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1100,7 +1100,9 @@ PHP_METHOD(SoapServer, __construct) service->version = version; service->type = SOAP_FUNCTIONS; service->soap_functions.functions_all = false; - service->soap_functions.ft = zend_new_array(0); + ALLOC_HASHTABLE(service->soap_functions.ft); + /* This hashtable contains zend_function pointers so doesn't need a destructor */ + zend_hash_init(service->soap_functions.ft, 0, NULL, NULL, false); SOAP_SERVER_BEGIN_CODE(); if (wsdl) { @@ -1226,7 +1228,7 @@ PHP_METHOD(SoapServer, setObject) PHP_METHOD(SoapServer, getFunctions) { soapServicePtr service; - HashTable *ft = NULL; + const HashTable *ft = NULL; ZEND_PARSE_PARAMETERS_NONE(); @@ -1240,11 +1242,7 @@ PHP_METHOD(SoapServer, getFunctions) } else if (service->soap_functions.functions_all) { ft = EG(function_table); } else if (service->soap_functions.ft != NULL) { - zval *name; - - ZEND_HASH_MAP_FOREACH_VAL(service->soap_functions.ft, name) { - add_next_index_str(return_value, zend_string_copy(Z_STR_P(name))); - } ZEND_HASH_FOREACH_END(); + ft = service->soap_functions.ft; } if (ft != NULL) { zend_function *f; @@ -1263,7 +1261,7 @@ PHP_METHOD(SoapServer, getFunctions) PHP_METHOD(SoapServer, addFunction) { soapServicePtr service; - zval *function_name, function_copy; + zval *function_name; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &function_name) == FAILURE) { RETURN_THROWS(); @@ -1279,7 +1277,9 @@ PHP_METHOD(SoapServer, addFunction) if (service->soap_functions.ft == NULL) { service->soap_functions.functions_all = false; - service->soap_functions.ft = zend_new_array(zend_hash_num_elements(Z_ARRVAL_P(function_name))); + ALLOC_HASHTABLE(service->soap_functions.ft); + /* This hashtable contains zend_function pointers so doesn't need a destructor */ + zend_hash_init(service->soap_functions.ft, zend_hash_num_elements(Z_ARRVAL_P(function_name)), NULL, NULL, false); } ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(function_name), tmp_function) { @@ -1292,15 +1292,15 @@ PHP_METHOD(SoapServer, addFunction) } key = zend_string_tolower(Z_STR_P(tmp_function)); + f = zend_hash_find_ptr(EG(function_table), key); - if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { + if (f == NULL) { zend_string_release_ex(key, false); zend_type_error("SoapServer::addFunction(): Function \"%s\" not found", Z_STRVAL_P(tmp_function)); RETURN_THROWS(); } - ZVAL_STR_COPY(&function_copy, f->common.function_name); - zend_hash_update(service->soap_functions.ft, key, &function_copy); + zend_hash_update_ptr(service->soap_functions.ft, key, f); zend_string_release_ex(key, 0); } ZEND_HASH_FOREACH_END(); @@ -1310,19 +1310,20 @@ PHP_METHOD(SoapServer, addFunction) zend_function *f; key = zend_string_tolower(Z_STR_P(function_name)); - - if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { + f = zend_hash_find_ptr(EG(function_table), key); + if (f == 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)); RETURN_THROWS(); } if (service->soap_functions.ft == NULL) { service->soap_functions.functions_all = false; - service->soap_functions.ft = zend_new_array(0); + ALLOC_HASHTABLE(service->soap_functions.ft); + /* This hashtable contains zend_function pointers so doesn't need a destructor */ + zend_hash_init(service->soap_functions.ft, 0, NULL, NULL, false); } - ZVAL_STR_COPY(&function_copy, f->common.function_name); - zend_hash_update(service->soap_functions.ft, key, &function_copy); + zend_hash_update_ptr(service->soap_functions.ft, key, f); zend_string_release_ex(key, 0); } else if (Z_TYPE_P(function_name) == IS_LONG) { if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) {

« previous php.cvs (#141891) next »