Browse Source

Merge pull request #1490 from dereuromark/2.4-mime

2.4 mime
Mark Story 12 years ago
parent
commit
2dd423644b
1 changed files with 7 additions and 2 deletions
  1. 7 2
      lib/Cake/Utility/File.php

+ 7 - 2
lib/Cake/Utility/File.php

@@ -557,9 +557,14 @@ class File {
 		}
 		if (function_exists('finfo_open')) {
 			$finfo = finfo_open(FILEINFO_MIME);
-			list($type, $charset) = explode(';', finfo_file($finfo, $this->pwd()));
+			$finfo = finfo_file($finfo, $this->pwd());
+			if (!$finfo) {
+				return false;
+			}
+			list($type, $charset) = explode(';', $finfo);
 			return $type;
-		} elseif (function_exists('mime_content_type')) {
+		}
+		if (function_exists('mime_content_type')) {
 			return mime_content_type($this->pwd());
 		}
 		return false;