Skip to content

ext/curl: Fix CURLOPT_PREREQFUNCTION to not continue on error conditions #16790

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

Open
wants to merge 1 commit into
base: PHP-8.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,13 +722,13 @@ static size_t curl_xferinfo(void *clientp, curl_off_t dltotal, curl_off_t dlnow,
static int curl_prereqfunction(void *clientp, char *conn_primary_ip, char *conn_local_ip, int conn_primary_port, int conn_local_port)
{
php_curl *ch = (php_curl *)clientp;
int rval = CURL_PREREQFUNC_OK;
int rval = CURL_PREREQFUNC_ABORT;

// when CURLOPT_PREREQFUNCTION is set to null, curl_prereqfunction still
// When CURLOPT_PREREQFUNCTION is set to null, curl_prereqfunction still
// gets called. Return CURL_PREREQFUNC_OK immediately in this case to avoid
// zend_call_known_fcc() with an uninitialized FCC.
if (!ZEND_FCC_INITIALIZED(ch->handlers.prereq)) {
return rval;
return CURL_PREREQFUNC_OK;
}

#if PHP_CURL_DEBUG
Expand Down