Zend Framework

MimeType recognition broken in ZF 1.10.0

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.10.0
  • Fix Version/s: 1.10.1
  • Component/s: Zend_File_Transfer
  • Labels:
    None

Description

currently when i try to upload a file with the mimetype validator added to the zend_file_transfer class i get the following error:

Warning: finfo::finfo() [function.finfo-finfo]: Failed to load magic database at '/usr/share/misc/magic'. in /home/arjen/public_html/library/Zend/File/Transfer/Adapter/Abstract.php on line 1281

And because of this error the mimetypes are not correct if i do a Zend_debug on
$files = $upload->getFileInfo();
Zend_Debug::Dump($files);exit;

["name"] => string(13) "sample4mb.mp4"
["type"] => string(10) "text/plain"

However when i check the file: /Zend/File/Transfer/Adapter/Abstract.php -> _detectMimeType() line 1265

i see this:

if (!empty($magicFile)) { $mime = new finfo($const, $magicFile); } else { $mime = new finfo($const); }

$magicFile Can't be right, This variable isnt used anywhere in this function, and so this function can never find the right location for the mimetype Database. when i manually change line 1280 "$mime = new finfo($const);" into: $mime = new finfo($const, '/usr/share/file/magic'); my problem is solved.

Issue Links

Activity

Hide
Ramon Henrique Ornelas added a comment -

Reported in ZF-9068.
Fixed by @thomas in r20911.

Show
Ramon Henrique Ornelas added a comment - Reported in ZF-9068. Fixed by @thomas in r20911.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: