xref: /PHP-7.4/ext/curl/tests/bug64267.phpt (revision fd92b911)
1--TEST--
2Bug #64267 (CURLOPT_INFILE doesn't allow reset)
3--SKIPIF--
4<?php
5if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
6extension_loaded("curl") or die("skip need ext/curl");
7?>
8--FILE--
9<?php
10
11echo "TEST\n";
12
13$c = curl_init("http://google.com");
14$f = fopen(__FILE__,"r");
15var_dump(curl_setopt_array($c, [
16	CURLOPT_RETURNTRANSFER => true,
17	CURLOPT_UPLOAD => true,
18	CURLOPT_INFILE => $f,
19	CURLOPT_INFILESIZE => filesize(__FILE__),
20	CURLOPT_CONNECTTIMEOUT => 3,
21	CURLOPT_TIMEOUT => 3,
22]));
23fclose($f);
24var_dump(curl_setopt_array($c, [
25	CURLOPT_UPLOAD => false,
26	CURLOPT_INFILE => null,
27	CURLOPT_INFILESIZE => 0,
28]));
29curl_exec($c);
30var_dump(curl_getinfo($c, CURLINFO_RESPONSE_CODE));
31?>
32===DONE===
33--EXPECTF--
34TEST
35bool(true)
36bool(true)
37int(30%d)
38===DONE===
39