Skip to content

Abort curl transfer if callback throws exception - #22745

Open
Sjord wants to merge 2 commits into
php:masterfrom
Sjord:curl-abort-on-exception
Open

Abort curl transfer if callback throws exception#22745
Sjord wants to merge 2 commits into
php:masterfrom
Sjord:curl-abort-on-exception

Conversation

@Sjord

@Sjord Sjord commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Solves bug #16513

Also includes #16790

@Sjord
Sjord marked this pull request as ready for review July 15, 2026 18:35
@Sjord
Sjord requested a review from adoy as a code owner July 15, 2026 18:35
@Sjord

Sjord commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@cmb69 Could you review this?

Comment thread ext/curl/tests/curl_readfunction_throws_abort.phpt Outdated
@Sjord

Sjord commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@eyupcanakman Could you take a look at this?

@Sjord
Sjord force-pushed the curl-abort-on-exception branch from 9d664cb to 5f7cf70 Compare July 27, 2026 09:28
Comment thread ext/curl/interface.c
{
php_curl *ch = (php_curl *)clientp;
int rval = 0;
int rval = 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rval is 1 now, but the no-callback early return still hands it back, so with CURLOPT_NOPROGRESS at 0, clearing CURLOPT_PROGRESSFUNCTION makes every later transfer on the handle fail with errno 42 where it used to complete.
Same shape in curl_xferinfo, and curl_prereqfunction already returns CURL_PREREQFUNC_OK here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants