(Fixes issue 1851) CFileHelper::getMimeType() was causing an error if used with PHP 5.2 and PECL fileinfo extension

This commit is contained in:
alexander.makarow
2010-12-08 18:16:40 +00:00
parent bda2438797
commit 5a63cdd657
2 changed files with 6 additions and 2 deletions

View File

@@ -218,7 +218,9 @@ class CFileHelper
{
if(function_exists('finfo_open'))
{
$info=$magicFile===null ? finfo_open(FILEINFO_MIME_TYPE) : finfo_open(FILEINFO_MIME_TYPE,$magicFile);
$options=defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
$info=$magicFile===null ? finfo_open($options) : finfo_open($options,$magicFile);
if($info && ($result=finfo_file($info,$file))!==false)
return $result;
}