From 43141a0d92d662a3cc00a33b9b7b2e70c597665d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sat, 1 Sep 2018 01:47:10 +0200 Subject: [PATCH 1/3] [ticket/12629] Add debug.errors_show PHPBB3-12629 --- phpBB/config/development/config.yml | 1 + phpBB/includes/functions.php | 5 +++-- phpBB/phpbb/di/extension/container_configuration.php | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml index 67c0e5a871..0689521cac 100644 --- a/phpBB/config/development/config.yml +++ b/phpBB/config/development/config.yml @@ -8,6 +8,7 @@ core: exceptions: true load_time: true sql_explain: true + errors_show: true twig: debug: true diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 7a978553bd..465806f674 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3252,6 +3252,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user, $request; global $phpbb_root_path, $msg_title, $msg_long_text, $phpbb_log; + global $phpbb_container; // Do not display notices if we suppress them via @ if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE) @@ -3272,7 +3273,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) // Check the error reporting level and return if the error level does not match // If DEBUG is defined the default level is E_ALL - if (($errno & ((defined('DEBUG')) ? E_ALL : error_reporting())) == 0) + if (($errno & ($phpbb_container->getParameter('debug.errors_show') ? E_ALL : error_reporting())) == 0) { return; } @@ -3330,7 +3331,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $log_text .= '

BACKTRACE
' . $backtrace; } - if (defined('IN_INSTALL') || defined('DEBUG') || isset($auth) && $auth->acl_get('a_')) + if (defined('IN_INSTALL') || $phpbb_container->getParameter('debug.errors_show') || isset($auth) && $auth->acl_get('a_')) { $msg_text = $log_text; diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index 3a6502a4b3..0b0a848822 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -37,6 +37,7 @@ class container_configuration implements ConfigurationInterface ->booleanNode('exceptions')->defaultValue(false)->end() ->booleanNode('load_time')->defaultValue(false)->end() ->booleanNode('sql_explain')->defaultValue(false)->end() + ->booleanNode('errors_show')->defaultValue(false)->end() ->end() ->end() ->arrayNode('twig') From 06a8affd66734db82a147f73203d6a15707dc603 Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 13 Sep 2018 14:40:47 +0000 Subject: [PATCH 2/3] [ticket/12629] Rename errors_show to show_errors PHPBB3-12629 --- phpBB/config/development/config.yml | 2 +- phpBB/includes/functions.php | 4 ++-- phpBB/phpbb/di/extension/container_configuration.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml index 0689521cac..e2d674e498 100644 --- a/phpBB/config/development/config.yml +++ b/phpBB/config/development/config.yml @@ -8,7 +8,7 @@ core: exceptions: true load_time: true sql_explain: true - errors_show: true + show_errors: true twig: debug: true diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 465806f674..1cf0a7df8c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3273,7 +3273,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) // Check the error reporting level and return if the error level does not match // If DEBUG is defined the default level is E_ALL - if (($errno & ($phpbb_container->getParameter('debug.errors_show') ? E_ALL : error_reporting())) == 0) + if (($errno & ($phpbb_container->getParameter('debug.show_errors') ? E_ALL : error_reporting())) == 0) { return; } @@ -3331,7 +3331,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $log_text .= '

BACKTRACE
' . $backtrace; } - if (defined('IN_INSTALL') || $phpbb_container->getParameter('debug.errors_show') || isset($auth) && $auth->acl_get('a_')) + if (defined('IN_INSTALL') || $phpbb_container->getParameter('debug.show_errors') || isset($auth) && $auth->acl_get('a_')) { $msg_text = $log_text; diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index 0b0a848822..7b280b6d6e 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -37,7 +37,7 @@ class container_configuration implements ConfigurationInterface ->booleanNode('exceptions')->defaultValue(false)->end() ->booleanNode('load_time')->defaultValue(false)->end() ->booleanNode('sql_explain')->defaultValue(false)->end() - ->booleanNode('errors_show')->defaultValue(false)->end() + ->booleanNode('show_errors')->defaultValue(false)->end() ->end() ->end() ->arrayNode('twig') From 9a5edd2874606249509c37f67af4e9aefb38f224 Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 13 Sep 2018 15:17:12 +0000 Subject: [PATCH 3/3] [ticket/12629] Fix tests PHPBB3-12629 --- tests/controller/common_helper_route.php | 2 +- tests/controller/controller_test.php | 2 +- tests/pagination/pagination_test.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index 3c732ff49b..58234e82b4 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -139,7 +139,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case new \phpbb\routing\file_locator(dirname(__FILE__) . '/') ); $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); - $this->router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php'); + $this->router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false); // Set correct current phpBB root path $this->root_path = $this->get_phpbb_root_path(); diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 3bab158ac8..7b9f92d048 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -48,7 +48,7 @@ class phpbb_controller_controller_test extends phpbb_test_case new \phpbb\routing\file_locator(dirname(__FILE__) . '/') ); $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); - $router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php'); + $router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false); $routes = $router->get_routes(); // This will need to be updated if any new routes are defined diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index a9c78059a5..be20d79282 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -46,7 +46,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case new \phpbb\routing\file_locator(dirname(__FILE__) . '/') ); $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $manager); - $router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, dirname(__FILE__) . '/', 'php'); + $router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false); $request = new phpbb_mock_request(); $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);