Skip to content

Commit de38ce1

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 25ffdc8 + 32ae716 commit de38ce1

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ PHP NEWS
1717
. Fixed bug #77447 (PHP 7.3 built with ASAN crashes in
1818
zend_cpu_supports_avx2). (Nikita)
1919

20+
- Curl:
21+
. Fixed bug #76675 (Segfault with H2 server push). (Pedro Magalhães)
22+
2023
- Fileinfo:
2124
. Fixed bug #77346 (webm files incorrectly detected as
2225
application/octet-stream). (Anatol)

ext/curl/multi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
502502
Z_ADDREF_P(pz_parent_ch);
503503

504504
res = zend_register_resource(ch, le_curl);
505+
ch->res = res;
505506
ZVAL_RES(&pz_ch, res);
506507

507508
size_t i;

ext/curl/tests/bug76675.phpt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--TEST--
2+
Bug #76675 (Segfault with H2 server push write/writeheader handlers)
3+
--SKIPIF--
4+
<?php
5+
include 'skipif.inc';
6+
if (getenv("SKIP_ONLINE_TESTS")) {
7+
die("skip online test");
8+
}
9+
$curl_version = curl_version();
10+
if ($curl_version['version_number'] < 0x073d00) {
11+
exit("skip: test may crash with curl < 7.61.0");
12+
}
13+
?>
14+
--FILE--
15+
<?php
16+
$transfers = 1;
17+
$callback = function($parent, $passed) use (&$transfers) {
18+
curl_setopt($passed, CURLOPT_WRITEFUNCTION, function ($ch, $data) {
19+
echo "Received ".strlen($data);
20+
return strlen($data);
21+
});
22+
$transfers++;
23+
return CURL_PUSH_OK;
24+
};
25+
$mh = curl_multi_init();
26+
curl_multi_setopt($mh, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
27+
curl_multi_setopt($mh, CURLMOPT_PUSHFUNCTION, $callback);
28+
$ch = curl_init();
29+
curl_setopt($ch, CURLOPT_URL, 'https://http2.golang.org/serverpush');
30+
curl_setopt($ch, CURLOPT_HTTP_VERSION, 3);
31+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
32+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
33+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
34+
curl_multi_add_handle($mh, $ch);
35+
$active = null;
36+
do {
37+
$status = curl_multi_exec($mh, $active);
38+
do {
39+
$info = curl_multi_info_read($mh);
40+
if (false !== $info && $info['msg'] == CURLMSG_DONE) {
41+
$handle = $info['handle'];
42+
if ($handle !== null) {
43+
$transfers--;
44+
curl_multi_remove_handle($mh, $handle);
45+
curl_close($handle);
46+
}
47+
}
48+
} while ($info);
49+
} while ($transfers);
50+
curl_multi_close($mh);
51+
?>
52+
--EXPECTREGEX--
53+
(Received \d+)+

0 commit comments

Comments
 (0)