ID: 38235 Updated by: [EMAIL PROTECTED] Reported By: tony at marston-home dot demon dot co dot uk -Status: Open +Status: Wont fix Bug Type: Filesystem function related Operating System: Windows XP PHP Version: 5CVS-2006-07-27 (CVS) New Comment:
This extension was deprecated a while ago. Use the fileinfo extension instead: http://pecl.php.net/package/Fileinfo (It will replace mime_magic in core in future anyway) Previous Comments: ------------------------------------------------------------------------ [2006-12-21 17:48:05] sonne at gaskanalen dot dk When using a WinXp with 5.2 i get errors when loading the magic.mime file ------ just a snippet [21-Dec-2006 18:42:50] PHP Warning: PHP Startup: : (C:\wamp\php\extras\magic.mime:360) 'HP48 text' is not a valid mimetype, entry skipped in Unknown on line 0 [21-Dec-2006 18:42:50] PHP Warning: PHP Startup: : (C:\wamp\php\extras\magic.mime:361) 'hp200 (68010) BSD' is not a valid mimetype, entry skipped in Unknown on line 0 [21-Dec-2006 18:42:50] PHP Warning: PHP Startup: : (C:\wamp\php\extras\magic.mime:362) 'hp300 (68020+68881) BSD' is not a valid mimetype, entry skipped in Unknown on line 0 [21-Dec-2006 18:42:50] PHP Warning: PHP Startup: : (C:\wamp\php\extras\magic.mime:363) '370 XA sysV executable ' is not a valid mimetype, entry skipped in Unknown on line 0 [21-Dec-2006 18:42:50] PHP Warning: PHP Startup: : (C:\wamp\php\extras\magic.mime:364) '370 XA sysV pure executable ' is not a valid mimetype, entry skipped in Unknown on line 0 I tryed downloading the zip file with windows binaries both from lates 5 and 4 series and use thoose magic.mime, they don't work i also tryed jusing the magic file from apache, i don't get any errors in the log with this one, but the functions both mime_content_type and finfo_open dosnøt work with this either. ------------------------------------------------------------------------ [2006-07-27 16:04:37] tony at marston-home dot demon dot co dot uk I've also tried replacing it with the one I use on my other PC which runs PHP 4, but I get the same error. ------------------------------------------------------------------------ [2006-07-27 16:03:01] tony at marston-home dot demon dot co dot uk It is the one included in the zip file which I downloaded from the PHP website. ------------------------------------------------------------------------ [2006-07-27 12:40:09] [EMAIL PROTECTED] it sounds to me like you mime magic file is invalid and subsequently results in an empty mime database in PHP. This would explain why the function always returns false. Where did you get the mime magic file that you are using? ------------------------------------------------------------------------ [2006-07-27 10:52:37] tony at marston-home dot demon dot co dot uk Description: ------------ When I use mime_content_type("picture.jpg") it always returns FALSE instead of "image/jpeg". At runtime I see the error "mime_content_type(): mime_magic not initialized". I have the following in my php.ini file: [mime_magic] mime_magic.magicfile = "F:/PHP5/extras/magic.mime" mime_magic.debug = On This information shows up correctly with phpinfo(). I also notice in the phperror.log a lot of messages along the lines of: [27-Jul-2006 11:37:13] PHP Warning: PHP Startup: : (F:/PHP5/extras/magic.mime:274) 'L application/x-bootable' is not a valid mimetype, entry skipped in Unknown on line 0 Reproduce code: --------------- $content_type = mime_content_type("picture.jpg"); if (empty($content_type)) { echo "content_type is empty"; } Expected result: ---------------- I expect it to return "image/jpeg" for this file. Actual result: -------------- It always returns FALSE. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38235&edit=1