1--TEST--
2curl_copy_handle() allows to post CURLFile multiple times
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7include 'server.inc';
8$host = curl_cli_server_start();
9
10$ch1 = curl_init();
11curl_setopt($ch1, CURLOPT_SAFE_UPLOAD, 1);
12curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=file");
13curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
14
15$filename = __DIR__ . '/curl_copy_handle_variation3.txt';
16file_put_contents($filename, "Test.");
17$file = curl_file_create($filename);
18$params = array('file' => $file);
19var_dump(curl_setopt($ch1, CURLOPT_POSTFIELDS, $params));
20
21$ch2 = curl_copy_handle($ch1);
22
23var_dump(curl_exec($ch1));
24curl_close($ch1);
25
26var_dump(curl_exec($ch2));
27curl_close($ch2);
28?>
29--EXPECTF--
30bool(true)
31string(%d) "curl_copy_handle_variation3.txt|application/octet-stream|5"
32string(%d) "curl_copy_handle_variation3.txt|application/octet-stream|5"
33--CLEAN--
34<?php
35@unlink(__DIR__ . '/curl_copy_handle_variation3.txt');
36?>
37