mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Disable deprecation warnings unless ICINGAWEB_ENVIRONMENT is set to "dev" (#5359)
in ApplicationBootstrap#setupErrorHandling(). In webrouter.php disable them unconditionally (until ApplicationBootstrap#setupErrorHandling()) not to duplicate the check. ApplicationBootstrap#setupErrorHandling()) is called pretty early, so we won't miss much. fixes #5117 * In addition, this provides #5269 and mitigates #5152 in production where ICINGAWEB_ENVIRONMENT isn't set. (cherry picked from commit 5333f2deb71597b2907d77f6eb06ff6636560218)
This commit is contained in:
parent
879211df2e
commit
67ff0546c0
@ -568,7 +568,7 @@ abstract class ApplicationBootstrap
|
|||||||
*/
|
*/
|
||||||
protected function setupErrorHandling()
|
protected function setupErrorHandling()
|
||||||
{
|
{
|
||||||
error_reporting(E_ALL | E_STRICT);
|
error_reporting(getenv('ICINGAWEB_ENVIRONMENT') === 'dev' ? E_ALL : E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
|
||||||
ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
||||||
@ -579,7 +579,6 @@ abstract class ApplicationBootstrap
|
|||||||
switch ($errno) {
|
switch ($errno) {
|
||||||
case E_NOTICE:
|
case E_NOTICE:
|
||||||
case E_WARNING:
|
case E_WARNING:
|
||||||
case E_STRICT:
|
|
||||||
case E_RECOVERABLE_ERROR:
|
case E_RECOVERABLE_ERROR:
|
||||||
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
|
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use Icinga\Web\Controller\StaticController;
|
|||||||
use Icinga\Web\JavaScript;
|
use Icinga\Web\JavaScript;
|
||||||
use Icinga\Web\StyleSheet;
|
use Icinga\Web\StyleSheet;
|
||||||
|
|
||||||
error_reporting(E_ALL | E_STRICT);
|
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
if (isset($_SERVER['REQUEST_URI'])) {
|
if (isset($_SERVER['REQUEST_URI'])) {
|
||||||
$ruri = $_SERVER['REQUEST_URI'];
|
$ruri = $_SERVER['REQUEST_URI'];
|
||||||
|
@ -21,7 +21,7 @@ class LocalFileStorageTest extends BaseTestCase
|
|||||||
parent::__construct($name, $data, $dataName);
|
parent::__construct($name, $data, $dataName);
|
||||||
|
|
||||||
$this->oldErrorReportingLevel = error_reporting();
|
$this->oldErrorReportingLevel = error_reporting();
|
||||||
error_reporting(E_ALL | E_STRICT);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
||||||
if (error_reporting() === 0) {
|
if (error_reporting() === 0) {
|
||||||
@ -32,7 +32,6 @@ class LocalFileStorageTest extends BaseTestCase
|
|||||||
switch ($errno) {
|
switch ($errno) {
|
||||||
case E_NOTICE:
|
case E_NOTICE:
|
||||||
case E_WARNING:
|
case E_WARNING:
|
||||||
case E_STRICT:
|
|
||||||
case E_RECOVERABLE_ERROR:
|
case E_RECOVERABLE_ERROR:
|
||||||
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
|
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user