Bug #67516 [NEW]: wrong mimetypes with finfo_file(filename, FILEINFO_MIME_TYPE)

From: Date: Wed, 25 Jun 2014 17:00:19 +0000
Subject: Bug #67516 [NEW]: wrong mimetypes with finfo_file(filename, FILEINFO_MIME_TYPE)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186342@lists.php.net to get a copy of this message
From: spam2 at rhsoft dot net Operating system: Linux PHP version: 5.5.13 Package: Scripting Engine problem Bug Type: Bug Bug description:wrong mimetypes with finfo_file(filename, FILEINFO_MIME_TYPE) Description: ------------ i have at least one GIF image with 2.3 MB which is detected as application/octet-stream while '/usr/bin/file -b --mime-type' on the same machine correctly results in image/gif sadly i don't see here any option to attach the image :-( that makes it hard to implement relieable checks if the extension of uploads matchs the expected mime-type [harry@srv-rhsoft:~/Desktop]$ php mime.php /usr/bin/file -b --mime-type image/gif finfo_file(filename, FILEINFO_MIME_TYPE) application/octet-stream Test script: --------------- #!/usr/bin/php <?php echo '/usr/bin/file -b --mime-type' . "\n"; passthru('/usr/bin/file -b --mime-type ' . escapeshellarg(__DIR__ . '/1.gif')); echo "\n"; echo 'finfo_file(filename, FILEINFO_MIME_TYPE)' . "\n"; $finfo_handle = finfo_open(); echo finfo_file($finfo_handle, __DIR__ . '/1.gif', FILEINFO_MIME_TYPE) . "\n"; finfo_close($finfo_handle); ?> Expected result: ---------------- image/gif as result Actual result: -------------- application/octet-stream as result -- Edit bug report at https://bugs.php.net/bug.php?id=67516&edit=1 --

« previous php.bugs (#186342) next »