Hide PHP warnings in production mode (#765)
* Hide PHP warnings in production mode * Silence error reporing during second language file read
This commit is contained in:
parent
b547042af4
commit
2bad6efd9c
@ -1,3 +1,5 @@
|
||||
* Hide more PHP warnings in production mode, to ease the migration
|
||||
to PHP 8
|
||||
* Fix: Deleting a user was not possible
|
||||
* New images added via the ML will set loading="lazy", improving
|
||||
site performance for visitors (only if height and width known)
|
||||
|
@ -1305,12 +1305,18 @@ class serendipity_plugin_api
|
||||
static function load_language($path) {
|
||||
global $serendipity;
|
||||
|
||||
// We deactivate error reporting here, because in PHP 8 setting constants twice always throws a warning.
|
||||
// However, the language files of some plugins sometimes rely on constants being set only in the fallback
|
||||
// language file, so we do have to set the other constants twice.
|
||||
$oldReportingLevel = error_reporting();
|
||||
error_reporting(0);
|
||||
|
||||
$probelang = $path . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
|
||||
if (file_exists($probelang)) {
|
||||
include $probelang;
|
||||
} else {
|
||||
include $path . '/lang_en.inc.php';
|
||||
}
|
||||
include $path . '/lang_en.inc.php';
|
||||
error_reporting($oldReportingLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,11 @@ if (!isset($serendipity['production'])) {
|
||||
}
|
||||
|
||||
// Set error reporting
|
||||
error_reporting(E_ALL & ~(E_NOTICE|E_STRICT|E_DEPRECATED)); // is 22519 with 5.4+
|
||||
if ($serendipity['production']) {
|
||||
error_reporting(E_ALL & ~(E_WARNING|E_NOTICE|E_STRICT|E_DEPRECATED));
|
||||
} else {
|
||||
error_reporting(E_ALL & ~(E_NOTICE|E_STRICT|E_DEPRECATED));
|
||||
}
|
||||
|
||||
if ($serendipity['production'] !== true) {
|
||||
@ini_set('display_errors', 'on');
|
||||
|
Loading…
x
Reference in New Issue
Block a user