Commit c0f50ee3 authored by Florian Pritz's avatar Florian Pritz
Browse files

PHP7: Ignore Notice when getting mimetype

Sometimes php7 throws an internal notice in this function which we
convert to an exception. Catching the exception will however not set
$mimetype so this error needs to be ignored.

This should be removed once php has fixed the bug.

References: https://bugs.php.net/bug.php?id=71434

Signed-off-by: default avatarFlorian Pritz <bluewind@xinu.at>
parent b193c3a5
......@@ -337,7 +337,12 @@ function cache_function_full($key, $ttl, $function) {
// Return mimetype of file
function mimetype($file) {
$fileinfo = new finfo(FILEINFO_MIME_TYPE);
// XXX: Workaround for PHP#71434 https://bugs.php.net/bug.php?id=71434
$old = error_reporting();
error_reporting($old &~ E_NOTICE);
$mimetype = $fileinfo->file($file);
error_reporting($old);
return $mimetype;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment