Edit report at https://bugs.php.net/bug.php?id=58333&edit=1
ID: 58333 Updated by: [email protected] Reported by: gregor at gregor dot ru Summary: finfo::file() only generates error -Status: Open +Status: Closed Type: Bug -Package: Fileinfo +Package: PECL Operating System: Windows XP SP3 PHP Version: 5.2.5 -Assigned To: +Assigned To: yohgaki Block user comment: N Private report: N New Comment: I suppose this could be closed. Previous Comments: ------------------------------------------------------------------------ [2009-10-07 04:24:26] dragos dot rusu at ymail dot com I can reproduce this also on Centos 5.2 with PHP 5.2.11 and Apache/2.2.3 (fileinfo installed within PECL). If I set the environment (like manual says): putenv('MAGIC=/usr/share/file/magic'); => it's not taken into consideration If I set as 2nd parameter the mime file like: // file on disk: /etc/httpd/magic.mime $finfo = new finfo(FILEINFO_MIME, '/etc/httpd/magic'); => it validates the creation of the object but than I get a lot of errors like: "Warning: finfo::file() [finfo.file]: The invalid fileinfo object. in /www/projects/andrei/fileinfo/fileinfo.php on line 38 1.xlsx" So my only solution was to leave default PHP configuration and copy my magic file into: /usr/share/misc/magic.mime P.S. We cannot move to PHP 5.3 since we have an old(<2002) and large application and code was not refactored (yet! - hopefully). ------------------------------------------------------------------------ [2008-09-05 07:33:06] gregor at gregor dot ru Description: ------------ Fileinfo module isn't works. It generates exception. I've checked $finfo object exactly before $finfo->file() call and get_classname() correctly returns "finfo" and 0 get_class_methods() returns "[0] => finfo [1] => set_flags [2] => file [3] => buffer". BTW: There is not method "close"! I'm using php 5.2.6 (!) and pecl package which comes with it. Reproduce code: --------------- $filename='/webserver/sites/test/uploads/test.jpg'; $finfo = new finfo(FILEINFO_MIME, '/webserver/php/magic'); if (!$finfo) die("Can't open mime database"); $res = $finfo->file($filename); print($res); Expected result: ---------------- image/jpeg Actual result: -------------- Warning: finfo::file() [finfo.file]: The invalid fileinfo object. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=58333&edit=1 -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
