php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54241 PHP fails with newer fileinfo magic files
Submitted: 2011-03-13 11:29 UTC Modified: 2016-11-24 15:03 UTC
Votes:9
Avg. Score:4.6 ± 0.8
Reproduced:7 of 7 (100.0%)
Same Version:2 (28.6%)
Same OS:3 (42.9%)
From: olemarkus at gentoo dot org Assigned:
Status: Duplicate Package: Unknown/Other Function
PHP Version: 5.3.6RC3 OS:
Private report: No CVE-ID: None
 [2011-03-13 11:29 UTC] olemarkus at gentoo dot org
Description:
------------
PHP fails if one use the magic file shipped with file 5.05. The reason is that newer version(s) of file use libmagic version unsupported by the one bundled with PHP

Test script:
---------------
<?php
    $fileinfo=new finfo(FILEINFO_MIME, "/usr/share/misc/magic.mgc");
    var_dump($fileinfo->file("/tmp/test.jpg"));
?>

Expected result:
----------------
string(26) "image/jpeg; charset=binary" 

Actual result:
--------------
Warning: finfo::finfo(): Failed to load magic database at
'/usr/share/misc/magic.mgc'. in /var/www/localhost/htdocs/fileinfo.php on line
2 
Warning: finfo::file(): The invalid fileinfo object. in
/var/www/localhost/htdocs/fileinfo.php on line 3 bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-25 19:24 UTC] devurandom at gmx dot net
See-Also: https://bugs.php.net/bug.php?id=66095
 [2016-08-26 13:56 UTC] cmb@php.net
-Package: Filesystem function related +Package: Unknown/Other Function
 [2016-11-24 15:03 UTC] ab@php.net
-Status: Open +Status: Duplicate
 [2016-11-24 15:03 UTC] ab@php.net
See bug #66885.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 08:01:29 2024 UTC