php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57859 finfo_file will not return mime-type
Submitted: 2007-10-02 05:19 UTC Modified: 2020-11-15 04:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: online at patrick-brueckner dot de Assigned: cmb (profile)
Status: No Feedback Package: Unknown/Other Function
PHP Version: 5.2.1 OS: Linux 2.6.20 / Ubuntu 7.04
Private report: No CVE-ID: None
 [2007-10-02 05:19 UTC] online at patrick-brueckner dot de
Description:
------------
The below code does not return a mimetype string but an identify-like output.

Reproduce code:
---------------
<?php
$oFinfo = finfo_open(FILEINFO_MIME);
echo finfo_file($oFinfo,"/home/paddy/Firefox_wallpaper.png");
?>

Expected result:
----------------
image/png

Actual result:
--------------
PNG image data, 400 x 264, 8-bit/color RGB, non-interlaced

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-23 10:24 UTC] php at kingsquare dot nl
A possible answer to this bug lies in the inability to load a non standard mime.magic file.
(see bug #9798)

the problem below can be fixed using this (and only this) extra paramter in the finfo_open() call:
finfo_open(FILEINFO_MIME, '/usr/share/file/magic');

BUT, copying the magic file OR using a different file will not work:
finfo_open(FILEINFO_MIME, '/some/other/location');

on Debian (or Ubuntu) systems the default magic file (which ever that may be) is apperntly not used nor is a error given about not being able to open the magic database.
 [2020-11-03 16:28 UTC] cmb@php.net
-Status: Open +Status: Feedback -Package: Fileinfo +Package: Unknown/Other Function -Assigned To: +Assigned To: cmb
 [2020-11-03 16:28 UTC] cmb@php.net
Does that still happen with any of the actively supported PHP
versions[1]?  If so, please provide the file which triggers the
unexpected behavior for download.

[1] <https://www.php.net/supported-versions.php>
 [2020-11-15 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 10:01:27 2024 UTC