#48885 [Tbd]: finfo returns mime type + charset when FILEINFO_MIME is used

From: Date: Sun, 12 Jul 2009 12:32:34 +0000
Subject: #48885 [Tbd]: finfo returns mime type + charset when FILEINFO_MIME is used
References: 1  Groups: php.bugs php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2471@lists.php.net to get a copy of this message
ID: 48885 User updated by: majkl578 at gmail dot com Reported By: majkl578 at gmail dot com Status: To be documented Bug Type: Filesystem function related Operating System: Linux Debian PHP Version: 5.3.0 New Comment: Look: I tested the code mentioned in bug report on php 5.2.10, i used a JPEG image: On php 5.3.0 returns 'image/jpeg; charset=binary' On php 5.2.10 returns 'image/jpeg' only. So, my question is: is it a bug or a feature in 5.3? If it's a feature: 1. it is NOT backward compatible. 2. it does not have any meaning for files like images etc, only for text files. So? Previous Comments: ------------------------------------------------------------------------ [2009-07-11 22:45:11] pajoye@php.net pls update this example ------------------------------------------------------------------------ [2009-07-11 21:15:18] majkl578 at gmail dot com ok sorry for this. but if it is correct, informations here: http://php.net/manual/en/function.finfo-file.php are misleading (see Example #1), because there is not mentioned anything about this, just about mime type. ------------------------------------------------------------------------ [2009-07-11 20:44:07] scottmac@php.net This is correct, rfc2045 requires the character set to be there for mime type. ------------------------------------------------------------------------ [2009-07-11 12:46:42] majkl578 at gmail dot com Description: ------------ When finfo is used with FILEINFO_MIME flag for a file, it returns mime type + charset (in this format: mime/type; charset=foo Configure Command: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql' '--with-mysqli' '--with-curl' '--with-sqlite' '--with-gd' '--enable-mbstring' '--with-openssl' '--disable-short-tags' '--with-mcrypt' '--with-bz2' '--with-zlib' '--enable-zip' Reproduce code: --------------- $obj = new \finfo(FILEINFO_MIME); echo $obj->file('/tmp/phpbug'); //in file is plain text Expected result: ---------------- text/plain Actual result: -------------- text/plain; charset=us-ascii ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48885&edit=1

« previous php.doc.bugs (#2471) next »