Issues

ZF-3320: Zend/Http/Client.php requires the mime_magic extension which was declared deprecated

Issue Type: Improvement Created: 2008-05-24T09:54:43.000+0000 Last Updated: 2010-11-24T02:57:41.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Jess Portnoy (jess04) Assignee: Shahar Evron (shahar) Tags: - Zend_Http_Client

Related issues: Attachments:

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.

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts