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

From: Date: Sun, 11 Jan 2015 16:24:23 +0000
Subject: Bug #68731 [Asn]: 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-189888@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:         danack@php.net
 Reported by:        sjaillet at gmail dot com
 Summary:            finfo_buffer doesn't extract the correct mime with
                     some gifs
 Status:             Assigned
 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:

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


Previous Comments:
------------------------------------------------------------------------
[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 (#189888) next »