Skip to content

Commit 3a1a205

Browse files
committed
Fix GH-16723: CURLMOPT_PUSHFUNCTION issues
We copy the source handler's FCCs to those of the destination. We also fix the erroneous test assumption that the trampoline wouldn't be called. Closes GH-16732.
1 parent ef1e186 commit 3a1a205

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ PHP NEWS
55
- Calendar:
66
. Fixed jdtogregorian overflow. (David Carlier)
77

8+
- Curl:
9+
. Fixed bug GH-16723 (CURLMOPT_PUSHFUNCTION issues). (cmb)
10+
811
- PDO:
912
. Fixed memory leak of `setFetchMode()`. (SakiTakamachi)
1013

ext/curl/interface.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,13 +1284,13 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
12841284
ch->handlers.read->res = source->handlers.read->res;
12851285

12861286
if (ZEND_FCC_INITIALIZED(source->handlers.read->fcc)) {
1287-
zend_fcc_dup(&source->handlers.read->fcc, &source->handlers.read->fcc);
1287+
zend_fcc_dup(&ch->handlers.read->fcc, &source->handlers.read->fcc);
12881288
}
12891289
if (ZEND_FCC_INITIALIZED(source->handlers.write->fcc)) {
1290-
zend_fcc_dup(&source->handlers.write->fcc, &source->handlers.write->fcc);
1290+
zend_fcc_dup(&ch->handlers.write->fcc, &source->handlers.write->fcc);
12911291
}
12921292
if (ZEND_FCC_INITIALIZED(source->handlers.write_header->fcc)) {
1293-
zend_fcc_dup(&source->handlers.write_header->fcc, &source->handlers.write_header->fcc);
1293+
zend_fcc_dup(&ch->handlers.write_header->fcc, &source->handlers.write_header->fcc);
12941294
}
12951295

12961296
curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);

ext/curl/tests/curl_pushfunction_trampoline.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ sort($responses);
6060
print_r($responses);
6161
?>
6262
--EXPECT--
63+
Trampoline for trampoline
6364
Array
6465
(
6566
[0] => main response

0 commit comments

Comments
 (0)