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
|
* Fix: Deleting a user was not possible
|
||||||
* New images added via the ML will set loading="lazy", improving
|
* New images added via the ML will set loading="lazy", improving
|
||||||
site performance for visitors (only if height and width known)
|
site performance for visitors (only if height and width known)
|
||||||
@ -11,7 +13,7 @@
|
|||||||
* Change backend_image_add hook to always contain same structure
|
* Change backend_image_add hook to always contain same structure
|
||||||
* Split date and time input in editor into two input fields
|
* Split date and time input in editor into two input fields
|
||||||
* Improve performance of the media library by caching the file list
|
* Improve performance of the media library by caching the file list
|
||||||
|
|
||||||
Version 2.4-alpha2 ()
|
Version 2.4-alpha2 ()
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
* Adds 'image_id' to event 'backend_image_add' in addData array
|
* Adds 'image_id' to event 'backend_image_add' in addData array
|
||||||
|
@ -1305,12 +1305,18 @@ class serendipity_plugin_api
|
|||||||
static function load_language($path) {
|
static function load_language($path) {
|
||||||
global $serendipity;
|
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';
|
$probelang = $path . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
|
||||||
if (file_exists($probelang)) {
|
if (file_exists($probelang)) {
|
||||||
include $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
|
// 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) {
|
if ($serendipity['production'] !== true) {
|
||||||
@ini_set('display_errors', 'on');
|
@ini_set('display_errors', 'on');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user