Skip to content

Commit 99bc0a5

Browse files
committed
Use function table directly in soap do_request
The function will exist, avoid creating a temporary string and lowercasing it.
1 parent b156d37 commit 99bc0a5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

ext/soap/soap.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,6 @@ static bool do_request(zval *this_ptr, xmlDoc *request, const char *location, co
22092209
bool ret = true;
22102210
char *buf;
22112211
int buf_size;
2212-
zval func;
22132212
zval params[5];
22142213
bool _bailout = false;
22152214

@@ -2228,7 +2227,6 @@ static bool do_request(zval *this_ptr, xmlDoc *request, const char *location, co
22282227
ZVAL_STRINGL(Z_CLIENT_LAST_REQUEST_P(this_ptr), buf, buf_size);
22292228
}
22302229

2231-
ZVAL_STRINGL(&func,"__doRequest",sizeof("__doRequest")-1);
22322230
ZVAL_STRINGL(&params[0], buf, buf_size);
22332231
ZVAL_STRING(&params[1], location);
22342232
if (action == NULL) {
@@ -2239,10 +2237,12 @@ static bool do_request(zval *this_ptr, xmlDoc *request, const char *location, co
22392237
ZVAL_LONG(&params[3], version);
22402238
ZVAL_BOOL(&params[4], one_way);
22412239

2242-
if (call_user_function(NULL, this_ptr, &func, response, 5, params) != SUCCESS) {
2243-
add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL);
2244-
ret = false;
2245-
} else if (Z_TYPE_P(response) != IS_STRING) {
2240+
zend_function *func = zend_hash_str_find_ptr(&Z_OBJCE_P(this_ptr)->function_table, ZEND_STRL("__dorequest"));
2241+
ZEND_ASSERT(func != NULL);
2242+
2243+
zend_call_known_instance_method(func, Z_OBJ_P(this_ptr), response, 5, params);
2244+
2245+
if (Z_TYPE_P(response) != IS_STRING) {
22462246
if (EG(exception) && instanceof_function(EG(exception)->ce, zend_ce_error)) {
22472247
/* Programmer error in __doRequest() implementation, let it bubble up. */
22482248
} else if (Z_TYPE_P(Z_CLIENT_SOAP_FAULT_P(this_ptr)) != IS_OBJECT) {
@@ -2256,7 +2256,6 @@ static bool do_request(zval *this_ptr, xmlDoc *request, const char *location, co
22562256
} zend_catch {
22572257
_bailout = true;
22582258
} zend_end_try();
2259-
zval_ptr_dtor(&func);
22602259
zval_ptr_dtor(&params[2]);
22612260
zval_ptr_dtor(&params[1]);
22622261
zval_ptr_dtor(&params[0]);

0 commit comments

Comments
 (0)