Remove some uses of function_exists() where no longer necessary

This commit is contained in:
Zach Borboa
2021-11-25 11:11:32 -05:00
parent 9c08d0b2a1
commit 9c03d19715
2 changed files with 10 additions and 24 deletions
+6 -14
View File
@@ -115,20 +115,12 @@ function get_png()
return $tmp_filename;
}
if (function_exists('finfo_open')) {
function mime_type($file_path)
{
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime_type = finfo_file($finfo, $file_path);
finfo_close($finfo);
return $mime_type;
}
} else {
function mime_type($file_path)
{
$mime_type = mime_content_type($file_path);
return $mime_type;
}
function mime_type($file_path)
{
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime_type = finfo_file($finfo, $file_path);
finfo_close($finfo);
return $mime_type;
}
function upload_file_to_server($upload_file_path) {
+4 -10
View File
@@ -312,11 +312,8 @@ if ($test === 'http_basic_auth') {
echo '}' . "\n";
exit;
} elseif ($test === 'error_message') {
if (function_exists('http_response_code')) {
http_response_code(401);
} else {
header('HTTP/1.1 401 Unauthorized');
}
// 401 Unauthorized.
http_response_code(401);
exit;
} elseif ($test === 'redirect') {
if (!isset($_GET['redirect'])) {
@@ -342,11 +339,8 @@ if ($test === 'http_basic_auth') {
echo 'Redirected: ' . $request_method;
} else {
if ($request_method === 'POST') {
if (function_exists('http_response_code')) {
http_response_code(303);
} else {
header('HTTP/1.1 303 See Other');
}
// 303 See Other.
http_response_code(303);
header('Location: ?redirect');
} else {