From f93ddcb3827b91bb648a7d1cdfaa71c45b242f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sat, 1 Sep 2018 01:16:57 +0200 Subject: [PATCH 1/3] [ticket/12636] Add log.session_errors PHPBB3-12636 --- phpBB/config/development/config.yml | 3 +++ phpBB/phpbb/di/extension/container_configuration.php | 6 ++++++ phpBB/phpbb/di/extension/core.php | 6 ++++++ phpBB/phpbb/session.php | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml index 67c0e5a871..3709b100f0 100644 --- a/phpBB/config/development/config.yml +++ b/phpBB/config/development/config.yml @@ -17,3 +17,6 @@ core: extensions: composer_debug: true composer_verbose: true + + log: + session_errors: true diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index 3a6502a4b3..5df1ebb59e 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -54,6 +54,12 @@ class container_configuration implements ConfigurationInterface ->booleanNode('composer_verbose')->defaultValue(false)->end() ->end() ->end() + ->arrayNode('log') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('session_errors')->defaultValue(false)->end() + ->end() + ->end() ->end() ; return $treeBuilder; diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 75a037871f..2f57c2854c 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -110,6 +110,12 @@ class core extends Extension { $container->setParameter('debug.' . $name, $value); } + + // Set the log options + foreach ($config['log'] as $name => $value) + { + $container->setParameter('log.' . $name, $value); + } } /** diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 1b1bc3a428..73f40b4e33 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -481,7 +481,7 @@ class session else { // Added logging temporarily to help debug bugs... - if (defined('DEBUG') && $this->data['user_id'] != ANONYMOUS) + if ($phpbb_container->getParameter('log.session_errors') && $this->data['user_id'] != ANONYMOUS) { if ($referer_valid) { From ade145dc566ae16d9a6339853bf77c7d3e51aaf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sat, 1 Sep 2018 01:57:01 +0200 Subject: [PATCH 2/3] [ticket/12636] Add log.session_errors to mock container_builder PHPBB3-12636 --- tests/mock/container_builder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php index 05083c3a3c..b27b0e64cb 100644 --- a/tests/mock/container_builder.php +++ b/tests/mock/container_builder.php @@ -21,6 +21,7 @@ class phpbb_mock_container_builder implements ContainerInterface public function __construct() { $this->setParameter('debug.load_time', false); + $this->setParameter('log.session_errors', false); } /** From 03ea042d576a2c1213be9a86c1cd62bdf5eb7545 Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 13 Sep 2018 14:53:01 +0000 Subject: [PATCH 3/3] [ticket/12636] Rename log.session_errors to session.log_errors PHPBB3-12636 --- phpBB/config/development/config.yml | 4 ++-- phpBB/phpbb/di/extension/container_configuration.php | 4 ++-- phpBB/phpbb/di/extension/core.php | 4 ++-- phpBB/phpbb/session.php | 2 +- tests/mock/container_builder.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml index 3709b100f0..20cb8451d0 100644 --- a/phpBB/config/development/config.yml +++ b/phpBB/config/development/config.yml @@ -18,5 +18,5 @@ core: composer_debug: true composer_verbose: true - log: - session_errors: true + session: + log_errors: true diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index 5df1ebb59e..909a47c53e 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -54,10 +54,10 @@ class container_configuration implements ConfigurationInterface ->booleanNode('composer_verbose')->defaultValue(false)->end() ->end() ->end() - ->arrayNode('log') + ->arrayNode('session') ->addDefaultsIfNotSet() ->children() - ->booleanNode('session_errors')->defaultValue(false)->end() + ->booleanNode('log_errors')->defaultValue(false)->end() ->end() ->end() ->end() diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 2f57c2854c..db40feb4cf 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -112,9 +112,9 @@ class core extends Extension } // Set the log options - foreach ($config['log'] as $name => $value) + foreach ($config['session'] as $name => $value) { - $container->setParameter('log.' . $name, $value); + $container->setParameter('session.' . $name, $value); } } diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 73f40b4e33..7d40d4ef87 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -481,7 +481,7 @@ class session else { // Added logging temporarily to help debug bugs... - if ($phpbb_container->getParameter('log.session_errors') && $this->data['user_id'] != ANONYMOUS) + if ($phpbb_container->getParameter('session.log_errors') && $this->data['user_id'] != ANONYMOUS) { if ($referer_valid) { diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php index b27b0e64cb..17c4ae22dd 100644 --- a/tests/mock/container_builder.php +++ b/tests/mock/container_builder.php @@ -21,7 +21,7 @@ class phpbb_mock_container_builder implements ContainerInterface public function __construct() { $this->setParameter('debug.load_time', false); - $this->setParameter('log.session_errors', false); + $this->setParameter('session.log_errors', false); } /**