Skip to content

Commit e861cb5

Browse files
committed
Simplify some strtolower operations in ext/soap
1 parent e6d4b30 commit e861cb5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ext/soap/soap.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ PHP_METHOD(SoapServer, handle)
11881188
soapServicePtr service;
11891189
xmlDocPtr doc_request = NULL, doc_return = NULL;
11901190
zval function_name, *params, *soap_obj, retval;
1191-
char *fn_name, cont_len[30];
1191+
char cont_len[30];
11921192
int num_params = 0, size, i, call_status = 0;
11931193
xmlChar *buf;
11941194
HashTable *function_table;
@@ -1450,8 +1450,8 @@ PHP_METHOD(SoapServer, handle)
14501450
}
14511451
}
14521452
#endif
1453-
fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name));
1454-
if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name)) ||
1453+
zend_string *fn_name = zend_string_tolower(Z_STR(h->function_name));
1454+
if (zend_hash_exists(function_table, fn_name) ||
14551455
((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) &&
14561456
zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
14571457
if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) {
@@ -1472,25 +1472,25 @@ PHP_METHOD(SoapServer, handle)
14721472
}
14731473
php_output_discard();
14741474
soap_server_fault_ex(function, &h->retval, h);
1475-
efree(fn_name);
1475+
zend_string_release(fn_name);
14761476
if (service->type == SOAP_CLASS && soap_obj) {zval_ptr_dtor(soap_obj);}
14771477
goto fail;
14781478
} else if (EG(exception)) {
14791479
php_output_discard();
14801480
_soap_server_exception(service, function, ZEND_THIS);
1481-
efree(fn_name);
1481+
zend_string_release(fn_name);
14821482
if (service->type == SOAP_CLASS && soap_obj) {zval_ptr_dtor(soap_obj);}
14831483
goto fail;
14841484
}
14851485
} else if (h->mustUnderstand) {
14861486
soap_server_fault("MustUnderstand","Header not understood", NULL, NULL, NULL);
14871487
}
1488-
efree(fn_name);
1488+
zend_string_release(fn_name);
14891489
}
14901490
}
14911491

1492-
fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name));
1493-
if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(function_name)), Z_STRLEN(function_name)) ||
1492+
zend_string *fn_name = zend_string_tolower(Z_STR(function_name));
1493+
if (zend_hash_exists(function_table, fn_name) ||
14941494
((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) &&
14951495
zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
14961496
if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) {
@@ -1512,7 +1512,7 @@ PHP_METHOD(SoapServer, handle)
15121512
} else {
15131513
php_error(E_ERROR, "Function '%s' doesn't exist", Z_STRVAL(function_name));
15141514
}
1515-
efree(fn_name);
1515+
zend_string_release(fn_name);
15161516

15171517
if (EG(exception)) {
15181518
if (!zend_is_unwind_exit(EG(exception))) {

0 commit comments

Comments
 (0)