|
| 1 | +--TEST-- |
| 2 | +Test that cloning of Curl object post CURLFile multiple times with curl_multi_exec() |
| 3 | +--EXTENSIONS-- |
| 4 | +curl |
| 5 | +--FILE-- |
| 6 | +<?php |
| 7 | +include 'server.inc'; |
| 8 | +$host = curl_cli_server_start(); |
| 9 | + |
| 10 | +$ch1 = curl_init(); |
| 11 | +curl_setopt($ch1, CURLOPT_SAFE_UPLOAD, 1); |
| 12 | +curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=file"); |
| 13 | +// curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1); |
| 14 | + |
| 15 | +$filename = __DIR__ . '/curl_copy_handle_variation4.txt'; |
| 16 | +file_put_contents($filename, "Test."); |
| 17 | +$file = curl_file_create($filename); |
| 18 | +$params = array('file' => $file); |
| 19 | +var_dump(curl_setopt($ch1, CURLOPT_POSTFIELDS, $params)); |
| 20 | + |
| 21 | +$ch2 = clone $ch1; |
| 22 | +$ch3 = clone $ch1; |
| 23 | + |
| 24 | +$mh = curl_multi_init(); |
| 25 | +curl_multi_add_handle($mh, $ch1); |
| 26 | +curl_multi_add_handle($mh, $ch2); |
| 27 | +do { |
| 28 | + $status = curl_multi_exec($mh, $active); |
| 29 | + if ($active) { |
| 30 | + curl_multi_select($mh); |
| 31 | + } |
| 32 | +} while ($active && $status == CURLM_OK); |
| 33 | + |
| 34 | +curl_multi_remove_handle($mh, $ch1); |
| 35 | +curl_multi_remove_handle($mh, $ch2); |
| 36 | +curl_multi_remove_handle($mh, $ch3); |
| 37 | +curl_multi_close($mh); |
| 38 | +?> |
| 39 | +===DONE=== |
| 40 | +--EXPECT-- |
| 41 | +bool(true) |
| 42 | +curl_copy_handle_variation4.txt|application/octet-stream|5curl_copy_handle_variation4.txt|application/octet-stream|5===DONE=== |
| 43 | +--CLEAN-- |
| 44 | +<?php |
| 45 | +@unlink(__DIR__ . '/curl_copy_handle_variation4.txt'); |
| 46 | +?> |
0 commit comments