forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcurl_copy_handle_variation4.phpt
46 lines (41 loc) · 1.23 KB
/
curl_copy_handle_variation4.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
curl_copy_handle() allows to post CURLFile multiple times with curl_multi_exec()
--EXTENSIONS--
curl
--FILE--
<?php
include 'server.inc';
$host = curl_cli_server_start();
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_SAFE_UPLOAD, 1);
curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=file");
// curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
$filename = __DIR__ . '/curl_copy_handle_variation4.txt';
file_put_contents($filename, "Test.");
$file = curl_file_create($filename);
$params = array('file' => $file);
var_dump(curl_setopt($ch1, CURLOPT_POSTFIELDS, $params));
$ch2 = curl_copy_handle($ch1);
$ch3 = curl_copy_handle($ch1);
$mh = curl_multi_init();
curl_multi_add_handle($mh, $ch1);
curl_multi_add_handle($mh, $ch2);
do {
$status = curl_multi_exec($mh, $active);
if ($active) {
curl_multi_select($mh);
}
} while ($active && $status == CURLM_OK);
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_remove_handle($mh, $ch3);
curl_multi_close($mh);
?>
===DONE===
--EXPECT--
bool(true)
curl_copy_handle_variation4.txt|application/octet-stream|5curl_copy_handle_variation4.txt|application/octet-stream|5===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/curl_copy_handle_variation4.txt');
?>