From b4ccdd244b973bc2714204c10b1de3637d580ffd Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 26 Apr 2023 11:19:45 -0600 Subject: [PATCH] [bug] error reporting options user, dev, all (#6616) An enhancement that adds simple options to show what errors to show in the web interface. This also fixes a bug that causes an error in PHP8. --- core/install/resources/classes/install.php | 4 ++-- resources/require.php | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/core/install/resources/classes/install.php b/core/install/resources/classes/install.php index a341e209b5..a41c7c37d4 100644 --- a/core/install/resources/classes/install.php +++ b/core/install/resources/classes/install.php @@ -130,8 +130,8 @@ if (!class_exists('install')) { $conf .= "xml_handler.reg_as_number_alias = false\n"; $conf .= "xml_handler.number_as_presence_id = true\n"; $conf .= "\n"; - $conf .= "#error reporting hide show all errors except notices and warnings\n"; - $conf .= "error.reporting = 'E_ALL ^ E_NOTICE ^ E_WARNING'\n"; + $conf .= "#error reporting options: user,dev,all\n"; + $conf .= "error.reporting = 'user'\n"; //write the config file $file_handle = fopen($config_file,"w"); diff --git a/resources/require.php b/resources/require.php index 08c53e4b08..cc8980668a 100644 --- a/resources/require.php +++ b/resources/require.php @@ -41,9 +41,25 @@ define("PROJECT_PATH", $conf['project.path']); //set the error reporting + ini_set('display_errors', '1'); if (isset($conf['error.reporting'])) { - ini_set('display_errors', '1'); - error_reporting($conf['error.reporting']); + $error_reporting_scope = $conf['error.reporting']; + } + else { + $error_reporting_scope = 'user'; + } + switch ($error_reporting_scope) { + case 'user': + error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING); + break; + case 'dev': + error_reporting(E_ALL ^ E_NOTICE); + break; + case 'all': + error_reporting(E_ALL); + break; + default: + error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING); } //get the database connection settings