-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||
| --TEST-- | ||||||
| GH-21023 (crash with CURLOPT_XFERINFOFUNCTION set with an invalid callback) | ||||||
| --EXTENSIONS-- | ||||||
| curl | ||||||
| --INI-- | ||||||
| error_reporting = E_ALL & ~E_DEPRECATED | ||||||
| --FILE-- | ||||||
| <?php | ||||||
| include 'server.inc'; | ||||||
| $host = curl_cli_server_start(); | ||||||
| $url = "{$host}/get.inc"; | ||||||
| $ch = curl_init($url); | ||||||
| curl_setopt($ch, CURLOPT_NOPROGRESS, 0); | ||||||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||||||
| curl_setopt($ch, CURLOPT_XFERINFOFUNCTION, $callback); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| curl_exec($ch); | ||||||
| ?> | ||||||
| --EXPECTF-- | ||||||
| Warning: Undefined variable $callback in %s on line %d | ||||||
|
|
||||||
| Warning: Undefined variable $callback in %s on line %d | ||||||
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.