-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/soap: Refactor userland function calling code #19055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ext/soap/soap.c
Outdated
} else { | ||
call_status = call_user_function(EG(function_table), NULL, &h->function_name, &h->retval, h->num_params, h->parameters); | ||
} | ||
call_status = call_user_function(NULL, soap_obj, &h->function_name, &h->retval, h->num_params, h->parameters); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now you're passing soap_obj not only for service->type == SOAP_CLASS || service->type == SOAP_OBJECT
but now also for zend_hash_find_ptr_lc(function_table, Z_STR(h->function_name)) != NULL
. So this is changed behaviour, or what am I missing?
ext/soap/soap.c
Outdated
zval_ptr_dtor(soap_obj); | ||
soap_obj = NULL; | ||
} | ||
call_status = call_user_function(NULL, soap_obj, &function_name, &retval, num_params, params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
if (UNEXPECTED(header_fn == NULL)) { | ||
if (soap_obj_ce && soap_obj_ce->__call) { | ||
header_fn = zend_get_call_trampoline_func(soap_obj_ce, Z_STR(function_name), false); | ||
goto soap_header_func_call; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you structure the code in such a way to avoid this goto?
zend_function *header_fn = zend_hash_find_ptr_lc(function_table, Z_STR(h->function_name)); | ||
if (UNEXPECTED(header_fn == NULL)) { | ||
if (soap_obj_ce && soap_obj_ce->__call) { | ||
header_fn = zend_get_call_trampoline_func(soap_obj_ce, Z_STR(function_name), false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using zend_get_call_trampoline_func
you should also release the trampoline function when you're done with it. This usually doesn't cause problems because as long as you're outside of a trampoline call, this function will store the trampoline in EG(trampoline)
. It should be possible to test this by making a soap call from within a trampoline.
Commits should be reviewed in order.
This gets rid of some more
call_user_function
API calls and reduces the amount of string copying.