bug64267.phpt 738 B

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