|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-01-10 10:52 UTC] motin at demomusic dot nu
Description: ------------ Fileinfo should be able to use not only the magic-file supplied by Apache or the libmagic magic-file but also the magic-info included with the package shared-mime-info from freedesktop.org The files currently generated by shared-mime-info's update-mime-database are stored in binary form and trying to link to any of these files as the magic file yields the error: finfo_open(): Failed to load magic database at '/path/to/updated/files/magic'. in ... The same error is produced when trying any other of the updated files, as well as trying a copy of "magic" renamed to "magic.mime" (Needed for fileinfo ta accept the /etc/apache2/magic file earlier) Using the shared-mime-info magic-info would allow fileinfo to detect a lot more mimetypes more exactly. http://forums.devshed.com/php-development-5/how-do-i-use-magic-file-from-shared-mime-info-with-fileinfo-415722.html#post1711168 Reproduce code: --------------- $finfo = finfo_open(FILEINFO_MIME, "/path/to/updated/files/magic"); Expected result: ---------------- No errors, fileinfo object loading successsfully ready to be used. Actual result: -------------- finfo_open(): Failed to load magic database at '/path/to/updated/files/magic'. in ... PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 19:00:02 2025 UTC |
if /path/to/updated/files/magic is soft link, fix it follow patch. This is clearly bug. :-( I want to fix it. diff -urNp fileinfo.org/fileinfo.c fileinfo/fileinfo.c --- fileinfo.org/fileinfo.c 2006-11-08 06:18:51.000000000 +0900 +++ fileinfo/fileinfo.c 2007-10-04 23:22:43.000000000 +0900 @@ -260,12 +260,12 @@ PHP_FUNCTION(finfo_open) RETURN_FALSE; } - if (file_len) { /* user specified filed, perform open_basedir checks */ - if (!VCWD_REALPATH(file, resolved_path)) { - RETURN_FALSE; - } - file = resolved_path; + if (!VCWD_REALPATH(file, resolved_path)) { + RETURN_FALSE; + } + file = resolved_path; + if (file_len) { /* user specified filed, perform open_basedir checks */ if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) { RETURN_FALSE; }