summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-01-24 09:44:34 +0100
committerFlorian Pritz <bluewind@xinu.at>2016-01-24 09:44:34 +0100
commitc0f50ee369310a093daac2180cc25c67b760edf9 (patch)
treed6d88dd660bf99ed413bb42a6c73ae6dbc3ff601
parentb193c3a5f6ad8ce64122c30f6f1944493def84e3 (diff)
PHP7: Ignore Notice when getting mimetype0.9.10
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 <bluewind@xinu.at>
-rw-r--r--application/helpers/filebin_helper.php5
1 files changed, 5 insertions, 0 deletions
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;
}