Fileinfo __construct with explicit magic file
| Doc Bug #51732 | Fileinfo __construct with explicit magic file | ||||
|---|---|---|---|---|---|
| Submitted: | 2010-05-03 21:51 UTC | Modified: | 2010-05-04 11:12 UTC | ||
| From: | franssen dot roland at gmail dot com | Assigned: | kalle (profile) | ||
| Status: | Closed | Package: | Filesystem function related | ||
| PHP Version: | 5.3SVN-2010-05-03 (SVN) | OS: | WINNT | ||
| Private report: | No | CVE-ID: | None | ||
[2010-05-03 21:51 UTC] franssen dot roland at gmail dot com
Description: ------------ Not sure i've filled in correct PHP version; it's 5.3.1 however (packaged with xampplite 1.7.3). Im trying to initialize a fileinfo (finfo) object with an explicit NULL value as 2nd parameter assuming it can locate the magic file by default. Which should be fine, corresponding the documentation; "__construct ([ int $options = FILEINFO_NONE [, string $magic_file = NULL ]] )" @ http://php.net/manual/en/function.finfo-open.php Test script: --------------- <?php $fileInfo = new finfo(FILEINFO_MIME, null); var_dump($fileInfo); $fileInfo = new finfo(FILEINFO_MIME); var_dump($fileInfo); ?> Expected result: ---------------- object(finfo)#2 (0) { } object(finfo)#5 (0) { } Actual result: -------------- Warning: finfo::finfo(): Failed to load magic database at ''. in *** on line *** object(finfo)#2 (0) { } object(finfo)#5 (0) { }
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2010-05-04 10:01 UTC] kalle@php.net
[2010-05-04 10:51 UTC] pajoye@php.net
-Status: Bogus +Status: Closed -Assigned To: +Assigned To: pajoye
[2010-05-04 10:51 UTC] pajoye@php.net
Fixed in svn. Kalle, it allows to set default value to NULL like: function foo($v=NULL) { $fileInfo = new finfo(FILEINFO_MIME, $v); } without having to test for $v. Other PHP functions act like that.[2010-05-04 10:52 UTC] pajoye@php.net
-Status: Closed +Status: Assigned -Assigned To: pajoye +Assigned To: kalle
[2010-05-04 10:52 UTC] pajoye@php.net
[2010-05-04 11:12 UTC] pajoye@php.net
-Status: Assigned +Status: Closed
[2010-05-04 11:12 UTC] pajoye@php.net
[2011-02-17 22:27 UTC] alix dot axel at NOSPAM dot gmail dot com