It took me over two hours to find a work-around for this stupid bug - still present in the latest PHP release version for Windows…
finfo_open() screws up if you explicitly pass in null for the second parameter - you can see the bug report here…
public static function getMimeType($file,$magicFile=null)
{
if(function_exists('finfo_open'))
{
if(($info=$magicFile===null?finfo_open(FILEINFO_MIME_TYPE):finfo_open(FILEINFO_MIME_TYPE,$magicFile)) && ($result=finfo_file($info,$file))!==false)
return $result;
}
if(function_exists('mime_content_type') && ($result=mime_content_type($file))!==false)
return $result;
return self::getMimeTypeByExtension($file);
}
Apparently, the second argument to finfo_open() is not quite null after all - this quirky little work-around will fix it.