Forráskód Böngészése

[GENERIC] Zend_File & Zend_Validate:

- unified finfo detection

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21935 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 15 éve
szülő
commit
921324ca11

+ 1 - 1
library/Zend/File/Transfer/Adapter/Abstract.php

@@ -1291,7 +1291,7 @@ abstract class Zend_File_Transfer_Adapter_Abstract
                 $mime = @finfo_open($const);
             }
 
-            if ($mime !== false) {
+            if (!empty($mime)) {
                 $result = finfo_file($mime, $file);
             }
 

+ 1 - 1
library/Zend/Validate/File/ExcludeMimeType.php

@@ -73,7 +73,7 @@ class Zend_Validate_File_ExcludeMimeType extends Zend_Validate_File_MimeType
                 $mime = new finfo($const);
             }
 
-            if ($mime !== false) {
+            if (!empty($mime)) {
                 $this->_type = $mime->file($value);
             }
             unset($mime);

+ 3 - 3
library/Zend/Validate/File/MimeType.php

@@ -197,7 +197,7 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
         } else {
             $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
             $this->_finfo = @finfo_open($const, $file);
-            if ($this->_finfo === false) {
+            if (empty($this->_finfo)) {
                 $this->_finfo = null;
                 require_once 'Zend/Validate/Exception.php';
                 throw new Zend_Validate_Exception('The given magicfile is not accepted by finfo');
@@ -336,12 +336,12 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
                 $this->_finfo = @finfo_open($const, $mimefile);
             }
 
-            if ($this->_finfo === false) {
+            if (empty($this->_finfo)) {
                 $this->_finfo = @finfo_open($const);
             }
 
             $this->_type = null;
-            if ($this->_finfo !== false) {
+            if (!empty($this->_finfo)) {
                 $this->_type = finfo_file($this->_finfo, $value);
             }
         }