-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Gh16359 #16362
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
Gh16359 #16362
Conversation
608e339
to
66646b5
Compare
Zend/zend_API.h
Outdated
@@ -843,6 +843,12 @@ static zend_always_inline void zend_call_known_fcc( | |||
const zend_fcall_info_cache *fcc, zval *retval_ptr, uint32_t param_count, zval *params, HashTable *named_params) | |||
{ | |||
zend_function *func = fcc->function_handler; | |||
if (UNEXPECTED(!func)) { |
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.
This should be handled in curl, and not call zend_call_known_fcc
instead. I don't really know curl, but it looks like you might want to unset the PHP_CURL_USER
flag when it's set to null
.
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.
zend_call_known_fcc
must not be used without fcc->function_handler
.
I agree with @iluuu1994. This should be fixed in the extension code.
oki doki fair enough, going to update. |
ext/curl/interface.c
Outdated
@@ -1634,7 +1634,10 @@ static bool php_curl_set_callable_handler(zend_fcall_info_cache *const handler_f | |||
#define HANDLE_CURL_OPTION_CALLABLE_PHP_CURL_USER(curl_ptr, constant_no_function, handler_type) \ | |||
case constant_no_function##FUNCTION: { \ | |||
bool result = php_curl_set_callable_handler(&curl_ptr->handlers.handler_type->fcc, zvalue, is_array_config, #constant_no_function "FUNCTION"); \ | |||
if (!result) { \ | |||
if (!result \ | |||
|| (curl_ptr->handlers.read && !curl_ptr->handlers.read->fcc.function_handler) \ |
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.
There's ZEND_FCC_INITIALIZED
, you should probably use that. I'm also not sure setting it to null is considered unsuccessful.
ext/curl/interface.c
Outdated
if (!result \ | ||
|| (curl_ptr->handlers.read && !curl_ptr->handlers.read->fcc.function_handler) \ | ||
|| (curl_ptr->handlers.write && !curl_ptr->handlers.write->fcc.function_handler) \ | ||
|| (curl_ptr->handlers.write_header && !curl_ptr->handlers.write_header->fcc.function_handler)) { \ |
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.
This looks weird.
You probably have to check just if (!result)
or
if (!result || !curl_ptr->handlers.handler_type->fcc.function_handler)
.
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.
yes I just did locally I realised later..
ext/curl/interface.c
Outdated
case constant_no_function##FUNCTION: { \ | ||
bool result = php_curl_set_callable_handler(&curl_ptr->handlers.handler_type->fcc, zvalue, is_array_config, #constant_no_function "FUNCTION"); \ | ||
if (!result) { \ | ||
return FAILURE; \ | ||
} \ | ||
if (!curl_ptr->handlers.handler_type) { \ |
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.
It doesn't seem like this condition can be true? Otherwise we'd have a null pointer violation above.
ext/curl/interface.c
Outdated
} \ | ||
if (!ZEND_FCC_INITIALIZED(curl_ptr->handlers.handler_type->fcc)) { \ | ||
curl_ptr->handlers.handler_type->method = default_method; \ | ||
return FAILURE; \ |
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.
This should return SUCCESS
. Setting options to null
is allowed from what I understand. If you return FAILURE
here, you'll stop updating the other options in curl_setopt_array
, apart from also indicating an error in curl_setopt
.
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.
Thank you! This looks correct to me now. Maybe @Girgias can have a look as she was the one refactoring this code last.
would it be good to add an (zend) assert into the FCC part though ? |
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.
Arf, I thought that we always had an FCC in those cases.
Thanks for fixing this!
No description provided.