php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53452 fileinfo magic file path bug
Submitted: 2010-12-02 17:42 UTC Modified: 2010-12-11 16:14 UTC
Votes:6
Avg. Score:4.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:5 (100.0%)
Same OS:5 (100.0%)
From: gep at osiacat dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.3 OS: Cent OS
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: gep at osiacat dot ru
New email:
PHP Version: OS:

 

 [2010-12-02 17:42 UTC] gep at osiacat dot ru
Description:
------------
This bug was reproduced only in PHP 5.3.3 On PHP 5.2.6 works fine.
If you pass a path to magic file situated in Cent OS in "/usr/share/file/magic" 
to finfo_open, then PHP cannot parse magic file.

Though finfo_open(FILEINFO_MIME_TYPE) without second parameter as magic file path 
works fine. (magic file path is taken from system environment)

Test script:
---------------
$finfo = finfo_open(FILEINFO_MIME_TYPE, '/usr/share/file/magic'); 
echo finfo_file($finfo, 'www/images/message-container/info_icon.png');

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

Actual result:
--------------
PHP Notice:  finfo_open(): Warning: description `8-bit ISDN mu-law compressed 
(CCITT G.721 ADPCM voice data enco' truncated in /home/blackjack/www/test.php on 
line 1
PHP Notice:  finfo_open(): Warning: description `8-bit ISDN mu-law compressed 
(CCITT G.721 ADPCM voice data enco' truncated in /home/blackjack/www/test.php on 
line 1
PHP Notice:  finfo_open(): Warning: <= not supported in 
/home/blackjack/www/test.php on line 1
PHP Notice:  finfo_open(): Warning: <= not supported in 
/home/blackjack/www/test.php on line 1
PHP Notice:  finfo_open(): Warning: <= not supported in 
/home/blackjack/www/test.php on line 1
PHP Notice:  finfo_open(): Warning: >= not supported in 
/home/blackjack/www/test.php on line 1
PHP Warning:  finfo_open(): Failed to load magic database at 
'/usr/share/file/magic'. in /home/blackjack/www/test.php on line 1
PHP Warning:  finfo_file() expects parameter 1 to be resource, boolean given in 
/home/blackjack/www/test.php on line 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-11 16:14 UTC] iliaa@php.net
-Status: Open +Status: Bogus
 [2010-12-11 16:14 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

In PHP 5.3 the magic file is built-in into PHP and that is what should be used. 
the magic file found on the system may not always be what libmagic expects, hence 
the error.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 09:01:28 2024 UTC