php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68731 finfo_buffer doesn't extract the correct mime with some gifs
Submitted: 2015-01-03 03:31 UTC Modified: 2015-01-22 11:32 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 1 (0.0%)
From: sjaillet at gmail dot com Assigned: ab (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.6.4 OS: Ubuntu 14.04.1
Private report: No CVE-ID: None
 [2015-01-03 03:31 UTC] sjaillet at gmail dot com
Description:
------------
finfo_buffer doesn't extract the correct mime for gifs in PHP 5.6
Seems working as expected with PHP 5.5 & PHP 5.4

Test script:
---------------
$buffer = file_get_contents('http://s30.postimg.org/t89w8ep3x/favicon.gif');
$finfo = finfo_open(FILEINFO_MIME_TYPE);
echo finfo_buffer($finfo, $buffer);

Expected result:
----------------
Should display "image/gif"

Actual result:
--------------
"application/octet-stream"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-03 18:35 UTC] ab@php.net
-Assigned To: +Assigned To: ab
 [2015-01-04 17:22 UTC] sjaillet at gmail dot com
Btw something seems to go wrong at the byte 516 since:

echo finfo_buffer($finfo, substr($buffer, 0, 515)); // Display `'image/gif'` as expected
echo finfo_buffer($finfo, substr($buffer, 0, 516)); // Display `'application/octet-stream'`
 [2015-01-11 16:24 UTC] danack@php.net
Possibly related to https://bugs.php.net/bug.php?id=67516
 [2015-01-11 17:45 UTC] ab@php.net
-Status: Assigned +Status: Analyzed
 [2015-01-11 17:45 UTC] ab@php.net
This is a data error, looks like it's fixed in libmagic 5.18. So looking for a data fix ATM.

Thanks.
 [2015-01-22 11:28 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=093a23d1c4d8a6a986211aa00b672dc3392f438a
Log: Fixed bug #68731 finfo_buffer doesn't extract the correct mime with some gifs
 [2015-01-22 11:28 UTC] ab@php.net
-Status: Analyzed +Status: Closed
 [2015-01-22 11:29 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=093a23d1c4d8a6a986211aa00b672dc3392f438a
Log: Fixed bug #68731 finfo_buffer doesn't extract the correct mime with some gifs
 [2015-01-22 11:32 UTC] ab@php.net
The patch for the bug #67647 applies here.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC