-
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
Changes from 1 commit
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. Can you add it to https://wiki.php.net/rfc/deprecations_php_8_6 ?
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. done
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.
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. I don't understand how the behaviour can be differently depending on if it is undef or null? If it is then we have some bigger problems.
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. yes sure it s the same sorry I misread you. |
||||||
| 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.
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 ... is strange. Because this would imply all the other callable options suffer from the same problem. Or do they not?
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.
and yes
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.
gonna plug the rest of callables..
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.
well that was easy, only fnmatch remained, debug however was already protected apparently.