Bug #68731 [Asn->Ana]: finfo_buffer doesn't extract the correct mime with some gifs

From: Date: Sun, 11 Jan 2015 17:45:18 +0000
Subject: Bug #68731 [Asn->Ana]: finfo_buffer doesn't extract the correct mime with some gifs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189890@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68731&edit=1

 ID:                 68731
 Updated by:         ab@php.net
 Reported by:        sjaillet at gmail dot com
 Summary:            finfo_buffer doesn't extract the correct mime with
                     some gifs
-Status:             Assigned
+Status:             Analyzed
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Ubuntu 14.04.1
 PHP Version:        5.6.4
 Assigned To:        ab
 Block user comment: N
 Private report:     N

 New Comment:

This is a data error, looks like it's fixed in libmagic 5.18. So looking for a data fix ATM.

Thanks.


Previous Comments:
------------------------------------------------------------------------
[2015-01-11 17:40:37] ab@php.net

Related To: Bug #67516

------------------------------------------------------------------------
[2015-01-11 16:24:23] danack@php.net

Possibly related to https://bugs.php.net/bug.php?id=67516

------------------------------------------------------------------------
[2015-01-04 17:22:51] 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-03 03:31:50] 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"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68731&edit=1


Thread (6 messages)

« previous php.bugs (#189890) next »