|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [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) { } PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
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.