Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request zendframework/zendframework#4102 from sasezaki/val…
Browse files Browse the repository at this point in the history
…idator_fileinfo_simplify_constants

simplify constant usage. FILEINFO_MIME_TYPE is available since PHP 5.3.0
  • Loading branch information
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Transfer/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit dbb3bb5

Please sign in to comment.