ZF-9121: MimeType recognition broken in ZF 1.10.0

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.

Comments

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