[php-src] Issue #15752: `finfo_file()` fatal error message incorrect on empty filename argument.

From: Date: Wed, 04 Sep 2024 22:13:37 +0000
Subject: [php-src] Issue #15752: `finfo_file()` fatal error message incorrect on empty filename argument.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247702@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15752 Author: danielmorell ### Description The following code: ```php <?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

« previous php.bugs (#247702) next »