Edit report at https://bugs.php.net/bug.php?id=67516&edit=1
ID: 67516
Updated by: php-bugs@lists.php.net
Reported by: spam2 at rhsoft dot net
Summary: wrong mimetypes with finfo_file(filename,
FILEINFO_MIME_TYPE)
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.5.13
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2015-01-11 17:40:36] ab@php.net
Usage of external libmagic isn't possible for various reasons, the patched version is tightly
integrated with PHP.
@spam2, @fayez, which file/PHP versions was used?
@spam2, please post the image you've an issue with to http://picpaste.com/ . You could probably check with bug #68731
whether it's reproducible for you.
Thanks.
------------------------------------------------------------------------
[2014-07-04 13:56:32] spam2 at rhsoft dot net
i know by myself that it works for most files, but this bugtracker lacks capability to attach the
affected file,
anyways, if php would use systems file-utilities/libraries the behavior of PHP and other
applications would be indetical and it would not need to carry some MB of redundant data
------------------------------------------------------------------------
[2014-07-04 13:53:03] fayez at bem981 dot cu dot cc
i tried this example with gif image size:8.2m
and i get this result:
/usr/bin/file -b --mime-type
image/gif
finfo_file(filename, FILEINFO_MIME_TYPE)
image/gif
it's work
------------------------------------------------------------------------
[2014-06-29 14:57:44] spam2 at rhsoft dot net
what i completly don't understand is why PHP obviously brings it's on mime-magic and
static implementation instead just use the operating systems file-libs
------------------------------------------------------------------------
[2014-06-25 17:00:19] spam2 at rhsoft dot net
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 this bug report at https://bugs.php.net/bug.php?id=67516&edit=1