Edit report at https://bugs.php.net/bug.php?id=48885&edit=1
ID: 48885 Comment by: soccertux at gmail dot com Reported by: majkl578 at gmail dot com Summary: finfo returns mime type + charset when FILEINFO_MIME is used Status: Closed Type: Bug Package: Filesystem function related Operating System: Linux Debian PHP Version: 5.3.0 Block user comment: N Private report: N New Comment: Found this issue because we're experiencing a problem while downloading an image from a PHP server using a java client. [quote paj...@php.net] For the binary data, the charset will obviously be set to binary: image/gif; charset=binary [/quote] First binary is not a charset! The official charsets can be found here http://www.iana.org/assignments/character-sets and binary is not in this list. >From rfc http://www.ietf.org/rfc/rfc2046.txt A critical parameter that may be specified in the Content-Type field for "text/plain" data is the character set. Again not for binary blobs... Java is failing on this because binary is an unsupported set. Previous Comments: ------------------------------------------------------------------------ [2009-11-15 20:47:50] majkl578 at gmail dot com scottmac: Thank you, the constant you've added works like a charm. philip: On my Debian server, libmagic1 library is in version 4.26-1. mohdyusuf: try this: ------ $obj = new finfo(FILEINFO_MIME_TYPE); echo $obj->file('/tmp/whatever'); ------ Thank you. ------------------------------------------------------------------------ [2009-10-24 07:08:13] mohdyusuf at gmail dot com I used to do a direct comparison, for example if($mimeInfo = 'image/jpeg') ... But then, with this changes, the comparison broke. Fortunately I have a custom findStr() function that does the job. if(findStr('image/jpeg',$mimeInfo)) ... this solved my problem easily. ------------------------------------------------------------------------ [2009-08-04 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2009-07-27 05:26:20] phi...@php.net Which version of libmagic changed this? It should be added to the docs. Also, the docs don't mention how to link to libmagic nor mention that a bundled version is used [by default]. What's the situation? The only option I see with './configure --help' is --disable-fileinfo ... ------------------------------------------------------------------------ [2009-07-27 03:16:33] s...@php.net Automatic comment from SVN on behalf of scottmac Revision: http://svn.php.net/viewvc/?view=revision&revision=286383 Log: Update documentation to reflect change with the internal libmagic updates. See bug #48885 ------------------------------------------------------------------------ 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=48885 -- Edit this bug report at https://bugs.php.net/bug.php?id=48885&edit=1