From: Bjorn dot Wiberg at its dot uu dot se Operating system: IBM AIX 5.3 (5300-08-01-0819) PHP version: 5.3CVS-2008-10-17 (snap) PHP Bug Type: Filesystem function related Bug description: Fileinfo does not look for /usr/share/magic{.*} and coredumps
Description: ------------ The (5.3dev200810170630) bundled Fileinfo extension does not look for /usr/share/misc/magic{.*} as suggested by http://se.php.net/manual/en/function.finfo-open.php. Setting the environment variable MAGIC works, however. So does specifying the full path to to magic file in the call to finfo_open(). When it fails to find the magic file, PHP core dumps. Reproduce code: --------------- php -d extension_dir=/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' Also see "Actual result" below, which illustrates all this. Expected result: ---------------- No coredump, Actual result: -------------- [EMAIL PROTECTED]:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' Segmentation fault (core dumped) [EMAIL PROTECTED]:/# gdb /nynom/apache/php/bin/php ./core GNU gdb 6.0 Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-ibm-aix5.1.0.0"... Core was generated by `php'. Program terminated with signal 11, Segmentation fault. #0 0x107ca694 in bs1 (Illegal instruction (core dumped) [EMAIL PROTECTED]:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME, "/usr/local/share/file/magic");' (OK) [EMAIL PROTECTED]:/# export MAGIC=/usr/local/share/file/magic [EMAIL PROTECTED]:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' [EMAIL PROTECTED]:/# (OK) [EMAIL PROTECTED]:/# cd /usr/share/ [EMAIL PROTECTED]:/usr/share# mkdir misc [EMAIL PROTECTED]:/usr/share# cd misc/ [EMAIL PROTECTED]:/usr/share/misc# ln -s /usr/local/share/file/magic* . [EMAIL PROTECTED]:/usr/share/misc# ls -l total 0 lrwxrwxrwx 1 root system 27 2008-10-17 16:52 magic -> /usr/local/share/file/magic lrwxrwxrwx 1 root system 31 2008-10-17 16:52 magic.mgc -> /usr/local/share/file/magic.mgc lrwxrwxrwx 1 root system 32 2008-10-17 16:52 magic.mime -> /usr/local/share/file/magic.mime lrwxrwxrwx 1 root system 36 2008-10-17 16:52 magic.mime.mgc -> /usr/local/share/file/magic.mime.mgc [EMAIL PROTECTED]:/usr/share/misc# cd [EMAIL PROTECTED]:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' [EMAIL PROTECTED]:/# unset MAGIC [EMAIL PROTECTED]:/# export MAGIC [EMAIL PROTECTED]:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' Segmentation fault (core dumped) Fileinfo information from phpinfo(): fileinfo fileinfo support enabled version 1.0.5-dev -- Edit bug report at http://bugs.php.net/?id=46331&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46331&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46331&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46331&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46331&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46331&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46331&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46331&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46331&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46331&r=support Expected behavior: http://bugs.php.net/fix.php?id=46331&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46331&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46331&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46331&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46331&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46331&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46331&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46331&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46331&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46331&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46331&r=mysqlcfg