Closed
Description
Description
The following code:
<?php
$info = finfo_open(FILEINFO_MIME_TYPE);
if ($info) {
echo finfo_file($info, '') . PHP_EOL;
}
Resulted in this output:
PHP Fatal error: Uncaught ValueError: finfo_file(): Argument #1 ($finfo) cannot be empty in /some/dir/example.php:5
But I expected this output instead:
PHP Fatal error: Uncaught ValueError: finfo_file(): Argument #2 ($filename) cannot be empty in /some/dir/example.php:5
The empty second argument is miss-attributed in the error message to the first argument.
If a non-empty string e.g. "foo"
is passed as the second filename
argument this error does not occur.
PHP Version
PHP 8.1-8.3
Operating System
Ubuntu 18.04