|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57068 incorrect detection of magic file (/usr/share/misc/file)
Submitted: 2006-06-08 03:32 UTC Modified: 2006-11-07 16:28 UTC
From: zaa at zaa dot pp dot ru Assigned:
Status: Closed Package: Fileinfo (PECL)
PHP Version: 5.1.2 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: zaa at zaa dot pp dot ru
New email:
PHP Version: OS:


 [2006-06-08 03:32 UTC] zaa at zaa dot pp dot ru
MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /usr/share/misc/file/magic /etc/magic /usr/share/misc"
has incorrect path for file database in /usr/share/misc folder. Correct line looks as follows:

MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /usr/share/misc/file/magic /etc/magic /usr/share/misc/file"

Supplied patch fixes the issue and improves algorithm of magic file detection.

--- config.m4.orig      Wed May 24 00:48:38 2006
+++ config.m4   Wed May 24 00:51:24 2006
@@ -47,12 +47,15 @@ if test "$PHP_FILEINFO" != "no"; then

-  MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /usr/share/misc/file/magic /etc/magic /usr/share/misc"
-  for i in $MAGIC_MIME_LOCATIONS; do
-    if test -f $i; then
+  MAGIC_MIME_DIRS="/usr/local/share/file /usr/share/file /usr/share/misc/file /etc /usr/share/misc"
+  MAGIC_MIME_FILENAMES="magic magic.mime"
+  for i in $MAGIC_MIME_DIRS; do
+       for j in $MAGIC_MIME_FILENAMES; do
+               if test -f "$i/$j"; then
+                       PHP_DEFAULT_MAGIC_FILE="$i/$j"
+       done


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-27 04:53 UTC] r dot de dot groen at versatel dot nl
When I try this patch I get the message:
===>  Patching for pecl-fileinfo-1.0.3
===>  Applying FreeBSD patches for pecl-fileinfo-1.0.3
patch: **** malformed patch at line 22: AC_DEFINE_UNQUOTED(PHP_DEFAULT_MAGIC_FILE,"$PHP_DEFAULT_MAGIC_FILE",[magic file path])
=> Patch patch-config.m4 failed to apply cleanly.
*** Error code 1

What's wrong?
 [2006-09-28 06:27 UTC] zaa at zaa dot pp dot ru
As far as I understood you are trying to install pecl-fileinfo-1.0.3 port. The patch (its slightly modified version) is already incorporated into this version of the freebsd port (files/patch-config.m4 file).
 [2006-11-07 16:28 UTC] ilia at prohost dot org
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 20:01:29 2024 UTC