ZF-9121: MimeType recognition broken in ZF 1.10.0

Issue Type: Bug Created: 2010-02-09T01:04:44.000+0000 Last Updated: 2010-02-09T02:07:58.000+0000 Status: Resolved Fix version(s): - 1.10.1 (10/Feb/10)

Reporter: Arrow (arrow1800) Assignee: Thomas Weidner (thomas) Tags: - Zend_File_Transfer

Related issues: - ZF-9068



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.


Posted by Ramon Henrique Ornelas (ramon) on 2010-02-09T02:07:57.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.