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