Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

simplify constant usage. FILEINFO_MIME_TYPE is available since PHP 5.3.0 #4102

Closed
wants to merge 2 commits into from

2 participants

kazusuke sasezaki Matthew Weier O'Phinney
This page is out of date. Refresh to see the latest.
5 library/Zend/File/Transfer/Adapter/AbstractAdapter.php
View
@@ -1224,16 +1224,15 @@ protected function detectMimeType($value)
}
if (class_exists('finfo', false)) {
- $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
if (!empty($value['options']['magicFile'])) {
ErrorHandler::start();
- $mime = finfo_open($const, $value['options']['magicFile']);
+ $mime = finfo_open(FILEINFO_MIME_TYPE, $value['options']['magicFile']);
ErrorHandler::stop();
}
if (empty($mime)) {
ErrorHandler::start();
- $mime = finfo_open($const);
+ $mime = finfo_open(FILEINFO_MIME_TYPE);
ErrorHandler::stop();
}
5 library/Zend/Validator/File/ExcludeMimeType.php
View
@@ -61,13 +61,12 @@ public function isValid($value, $file = null)
$mimefile = $this->getMagicFile();
if (class_exists('finfo', false)) {
- $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
if (!$this->isMagicFileDisabled() && (!empty($mimefile) && empty($this->finfo))) {
- $this->finfo = finfo_open($const, $mimefile);
+ $this->finfo = finfo_open(FILEINFO_MIME_TYPE, $mimefile);
}
if (empty($this->finfo)) {
- $this->finfo = finfo_open($const);
+ $this->finfo = finfo_open(FILEINFO_MIME_TYPE);
}
$this->type = null;
8 library/Zend/Validator/File/MimeType.php
View
@@ -201,9 +201,8 @@ public function setMagicFile($file)
$file
));
} else {
- $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
ErrorHandler::start(E_NOTICE|E_WARNING);
- $this->finfo = finfo_open($const, $file);
+ $this->finfo = finfo_open(FILEINFO_MIME_TYPE, $file);
$error = ErrorHandler::stop();
if (empty($this->finfo)) {
$this->finfo = null;
@@ -376,16 +375,15 @@ public function isValid($value, $file = null)
$mimefile = $this->getMagicFile();
if (class_exists('finfo', false)) {
- $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
if (!$this->isMagicFileDisabled() && (!empty($mimefile) && empty($this->finfo))) {
ErrorHandler::start(E_NOTICE|E_WARNING);
- $this->finfo = finfo_open($const, $mimefile);
+ $this->finfo = finfo_open(FILEINFO_MIME_TYPE, $mimefile);
ErrorHandler::stop();
}
if (empty($this->finfo)) {
ErrorHandler::start(E_NOTICE|E_WARNING);
- $this->finfo = finfo_open($const);
+ $this->finfo = finfo_open(FILEINFO_MIME_TYPE);
ErrorHandler::stop();
}
Something went wrong with that request. Please try again.