2

Using this code:

$ch = curl_init('file:///c:/foo/bar/baz.txt');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);

$headers = curl_exec($ch);

curl_close($ch);

var_dump($headers);

In PHP 7.2 (and olders) returns:

string(88) "Content-Length: 57
Accept-ranges: bytes
Last-Modified: Sun, 29 Dec 2019 05:31:32 GMT
"

In PHP 7.3 and PHP 7.4 returns empty string:

string(0) ""

I'm using this code to get file sizes too large to avoid limitations, but my question is not quite how to fix this but whether this is a bug or a permanent change in new versions of PHP?

Protomen
  • 9,471
  • 9
  • 57
  • 124

0 Answers0