Doc #51732 [Opn->Bgs]: Fileinfo __construct with explicit magic file
| From: | kalle@php.net | Date: | Tue, 04 May 2010 08:01:13 +0000 |
| Subject: | Doc #51732 [Opn->Bgs]: Fileinfo __construct with explicit magic file | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4299@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51732&edit=1
ID: 51732
Updated by: kalle@php.net
Reported by: franssen dot roland at gmail dot com
Summary: Fileinfo __construct with explicit magic file
-Status: Open
+Status: Bogus
Type: Documentation Problem
Package: Filesystem function related
Operating System: WINNT
PHP Version: 5.3SVN-2010-05-03 (SVN)
New Comment:
Why are you trying to instanciate with the second parameter to the
default value when its optional?
Many functions depends internally on if 2 arguments were sent, if so
then no matter of the value of that specific parameter. In this case
NULL is simply a placeholder.
Previous Comments:
------------------------------------------------------------------------
[2010-05-03 21:51:44] 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) { }
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51732&edit=1