-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix GH-21023: CURLOPT_XFERINFOFUNCTION with invalid callback crash. #21025
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: PHP-8.4
Are you sure you want to change the base?
Conversation
we check the FCC is properly initialised beforehand in its handler.
| $ch = curl_init($url); | ||
| curl_setopt($ch, CURLOPT_NOPROGRESS, 0); | ||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
| curl_setopt($ch, CURLOPT_XFERINFOFUNCTION, $callback); |
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 seems the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION are aliases... should we deprecate one, or explicitly mark one constant as the alias of the other?
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.
PROGRESS is the one to be deprecated, we should at some point before next major release IMHO
| return rval; | ||
| } |
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.
I don't really understand how this can happen. It shouldn't be possible for this state to arise as this condition should be caught by the HANDLE_CURL_OPTION_CALLABLE, no? Or am I missing something here?
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.
no it is not, when I debugged php_curl_set_callable_handler earlier, the fcc was not initialised despite being succesful.
| $ch = curl_init($url); | ||
| curl_setopt($ch, CURLOPT_NOPROGRESS, 0); | ||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
| curl_setopt($ch, CURLOPT_XFERINFOFUNCTION, $callback); |
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.
| curl_setopt($ch, CURLOPT_XFERINFOFUNCTION, $callback); | |
| curl_setopt($ch, CURLOPT_XFERINFOFUNCTION, 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.
I am afraid it is not the same as here, it s an undefined var.
| curl_exec($ch); | ||
| $ch = curl_init($url); | ||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
| curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, $callback); |
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.
| curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, $callback); | |
| curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, null); |
we check the FCC is properly initialised beforehand.