From c0f50ee369310a093daac2180cc25c67b760edf9 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 24 Jan 2016 09:44:34 +0100 Subject: 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: Florian Pritz --- application/helpers/filebin_helper.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index 5e37f4b80..29c7d6eb8 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -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; } -- cgit v1.2.3-24-g4f1b