summaryrefslogtreecommitdiff
path: root/ext/curl/tests/bug64267.phpt
blob: ca1fe4b36805592fb9cdbd26750f0706cd5d0879 (plain)
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
--TEST--
Bug #64267 (CURLOPT_INFILE doesn't allow reset)
--SKIPIF--
<?php
if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
extension_loaded("curl") or die("skip need ext/curl");
?>
--FILE--
<?php

echo "TEST\n";

$c = curl_init("http://google.com");
$f = fopen(__FILE__,"r");
var_dump(curl_setopt_array($c, [
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_UPLOAD => true,
	CURLOPT_INFILE => $f,
	CURLOPT_INFILESIZE => filesize(__FILE__),
	CURLOPT_CONNECTTIMEOUT => 1,
	CURLOPT_TIMEOUT => 1,
]));
fclose($f);
var_dump(curl_setopt_array($c, [
	CURLOPT_UPLOAD => false,
	CURLOPT_INFILE => null,
	CURLOPT_INFILESIZE => 0,
]));
curl_exec($c);
var_dump(curl_getinfo($c, CURLINFO_RESPONSE_CODE));
?>
===DONE===
--EXPECTF--
TEST
bool(true)
bool(true)
int(30%d)
===DONE===