From dee22f4a281335b51333ff493b34c026f36e1804 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 11 Dec 2015 21:05:53 +0100 Subject: [ticket/14177] Uses Symfony's Debug ErrorHandler in development environment PHPBB3-14177 --- phpBB/common.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'phpBB/common.php') diff --git a/phpBB/common.php b/phpBB/common.php index 38761cfadc..48bd13e80d 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -90,8 +90,14 @@ include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); -// Set PHP error handler to ours -set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +if (PHPBB_ENVIRONMENT === 'development') +{ + \phpbb\debug\debug::enable(); +} +else +{ + set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +} $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); @@ -104,10 +110,17 @@ try } catch (InvalidArgumentException $e) { - trigger_error( - 'The requested environment ' . PHPBB_ENVIRONMENT . ' is not available.', - E_USER_ERROR - ); + if (PHPBB_ENVIRONMENT !== 'development') + { + trigger_error( + 'The requested environment ' . PHPBB_ENVIRONMENT . ' is not available.', + E_USER_ERROR + ); + } + else + { + throw $e; + } } $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); -- cgit v1.2.1