ZF-3320: Zend/Http/Client.php requires the mime_magic extension which was declared deprecated
Description
The function setFileUpload() uses mime_magic's mime_content_type(). Since mime_magic was declared deprecated and is replaced by PECL's Fileinfo extension. $PHP_SOURCE_ROOT/ext/mime_magic/DEPRECATED reads:
To keep existing code originaly coded for mime_magic without changes you may add the following compatibility wrapper function to your codebase:
function mime_content_type($file) { static $finfo = false;
if ($finfo === false) {
$finfo = finfo_open(MAGIC_MIME);
}
if (is_resource($file)) {
$buf = fread($fp, 65536);
return finfo_buffer($buf);
} else {
return finfo_file($file);
}
}
I think it would be best if the ZF includes this wrapper function and use it in the event the mime_magic extension is not loaded and Fileinfo is. This issue is important in FC for instance, where the mime_magic extension is not available in the FC repository and PECL's Fileinfo is but it is also a generally good idea.
Comments
Posted by Shahar Evron (shahar) on 2008-07-02T14:40:45.000+0000
Resolved in rev. 9906 - Both fileinfo and mime_magic will now be used in attempt to detect mime type
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:06.000+0000
Updating for the 1.6.0 release.
Posted by Hugo (huhu) on 2010-11-17T09:56:07.000+0000
Can the documentation be updated: http://framework.zend.com/manual/en/… The requirements page still shows mime_magic as a hard dependancy.
Posted by Shahar Evron (shahar) on 2010-11-24T02:57:39.000+0000
Hmm.. I didn't even know that page in the docs existed :)
Table updated, fix in trunk r23440, will be merged to 1.11 soon.