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

From: Date: Thu, 15 Dec 2016 13:59:01 +0000
Subject: Bug #67516 [Csd]: wrong mimetypes with finfo_file(filename, FILEINFO_MIME_TYPE)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206039@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67516&edit=1

 ID:                 67516
 User updated by:    spam2 at rhsoft dot net
 Reported by:        spam2 at rhsoft dot net
 Summary:            wrong mimetypes with finfo_file(filename,
                     FILEINFO_MIME_TYPE)
 Status:             Closed
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Linux
 PHP Version:        7.0.11
 Assigned To:        ab
 Block user comment: N
 Private report:     N

 New Comment:

BTW: wouldn't it be time at least instead having a 2 MB binary .so-extension to install the
magicfile in the extensions folder and by default point to this file?

loading 2 MB unconditional in memory because someone *could* use a fileinfo-function is very
questionable


Previous Comments:
------------------------------------------------------------------------
[2016-11-25 14:12:20] spam2 at rhsoft dot net

"I can only repeat, that your statement is wrong" is nonsense - for the cases where the
sysem libmagic on Fedora had wrong results it took hours or a few days days until there was a koji
build with a fix and not years
_______________________________

"I've asked you to contribute by testing, to ensure the state stability with the real data
in your app and to evaluate a possible backport chance. It's up to you" - JUST GIVE ME A
RECENT LIBMAGIC since uploads are verfied witin mod_security and the file command BECAUSE i
can't trust PHP - so any libmagic from F22 to F25 is fine
_______________________________

> Guess, which stable distribution this is. Your app could be running on it

no it could not - my app is running on the current stable Fedora release where also development
happens and don't need to run anywhere else since we develop and host it on own infrastrcuture
where nobody but me take scare about software versions - only the outdated libmagic of PHP is out of
my scope and since it's that outdated that even "/usr/bin/php
ext/fileinfo/create_data_file.php /usr/share/misc/magic.mgc > ext/fileinfo/data_file.c" in
the build-process does not work that's a problem
_______________________________

i explain it again:

if i ask on the same operating system two tools about the mimetype i expect the identical response -
be it correct or wrong - point is when somebody sends me a image via email with the question
"why does this dmaned cms-system not accept that image with a generic error message about wrong
filetype" typing "file -b --mime-type attachemnt.gif" should give a answer -
currently you get the expected result

------------------------------------------------------------------------
[2016-11-25 14:02:45] cmb@php.net

Harald, you may want to read <https://bugs.php.net/how-to-report.php>. :-)

------------------------------------------------------------------------
[2016-11-25 13:55:23] ab@php.net

@spam2 at rhsoft dot net, I can only repeat, that your statement is wrong. And probably add, that
the discussion in this form is not expedient.

$ file php-mimetype-bug.gif
php-mimetype-bug.gif: DOS/MBR boot sector

Guess, which stable distribution this is. Your app could be running on it.

The PHP solution is not worse and not better, than the vanilla lib or a package provided by a
distribution. It is a PITA for ext maintainers, not for you. There will be always a file failed to
be recognized correctly - that is not an acceptance criteria for such a broad usage.

I've asked you to contribute by testing, to ensure the state stability with the real data in
your app and to evaluate a possible backport chance. It's up to you. As for me - I retain from
the further discussion of this kind.

Thanks.

------------------------------------------------------------------------
[2016-11-25 12:41:40] spam2 at rhsoft dot net

but there is a promise that it don't take 2 years until some fix is proposed which takes
another 2 or 3 years to make it in a stable release because it's not a fork 

why do i need to build a PHP7.2 snapshot to test "my application" when the sample image is
still available at https://access.thelounge.net/harry/php-mimetype-bug.gif
and the oneliner "echo finfo_file(filename, FILEINFO_MIME_TYPE);" checks if it now
correctly reports a image mimetype

------------------------------------------------------------------------
[2016-11-25 12:20:57] ab@php.net

@spam2 at rhsoft dot net, what you say is not remotely true. There's absolutely no promise a
distribution shipped libmagic is always correct. It would be much more constructive, if you could
deliver a 7.2 test result with your app.

Thanks.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

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


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


Thread (30 messages)

« previous php.bugs (#206039) next »