php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57547 Settings options on file doesn't give same result as constructor options
Submitted: 2007-02-25 14:11 UTC Modified: 2016-11-24 23:51 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: jonas at websystem dot se Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.1.6 OS: Gentoo Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jonas at websystem dot se
New email:
PHP Version: OS:

 

 [2007-02-25 14:11 UTC] jonas at websystem dot se
Description:
------------
Hi..

When using the FILEINFO_MIME in ->file() I get different result then using it in the constructor. See example

Reproduce code:
---------------
$finfo = new finfo(FILEINFO_MIME);
echo $finfo->file($filename);

$finfo2 = new finfo();
echo $finfo2->file($filename, FILEINFO_MIME);



Expected result:
----------------
With: $filename = '..'
application/x-not-regular-file
application/x-not-regular-file

with: $filename = 'my .avi movie'
video/x-msvideo
video/x-msvideo


Actual result:
--------------
With: $filename = '..'
application/x-not-regular-file
application/x-not-regular-file

with: $filename = 'my .avi movie'
video/x-msvideo
RIFF (little-endian) data, AVI, 320 x 240, ~15 fps, video: Motion JPEG, audio: uncompressed PCM (mono, 11024 Hz)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-13 11:37 UTC] jstormes at yahoo dot com
finfo->buffer() appears to have the same bug.
 [2007-05-06 22:15 UTC] jm dot barbier at solidev dot org
i can confirm that using Apache/2.2.3 (Debian) DAV/2 
PHP/5.2.0-8+etch3 and this module, i'm not able to get any 
mimetype, even by putting FILEINFO_MIME in the 
constructor, but only textual description...
 [2007-05-06 22:36 UTC] jm dot barbier at solidev dot org
Two problems here, one reason : the magic file is loaded 
on finfo creation, so if you give FILEINFO_MIME, il will 
load the magic.mime file, and if you give anything else, 
il will load the magic.mgc file (or something like 
that)... that is not really a bug, just a documentation 
problem.

For me the solution was copying all magic files from 
linux "file" command to /etc/ : 

ln -s /usr/share/file/magic* /etc/
 [2016-11-24 23:51 UTC] ab@php.net
-Status: Open +Status: Not a bug -Package: Fileinfo +Package: *General Issues
 [2016-11-24 23:51 UTC] ab@php.net
Not reproducible with the currently supported PHP versions. Test added.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 07:01:28 2024 UTC