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

Resolved in rev. 9906 - Both fileinfo and mime_magic will now be used in attempt to detect mime type

Updating for the 1.6.0 release.

Can the documentation be updated: http://framework.zend.com/manual/en/… The requirements page still shows mime_magic as a hard dependancy.

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.