diff --git a/phpBB/config/default/container/services_routing.yml b/phpBB/config/default/container/services_routing.yml index 858556eb40..5b7fc35b5a 100644 --- a/phpBB/config/default/container/services_routing.yml +++ b/phpBB/config/default/container/services_routing.yml @@ -8,6 +8,7 @@ services: - '%core.php_ext%' - '%core.cache_dir%' - '%debug.url_generator%' + - '%debug.url_matcher%' router.listener: class: Symfony\Component\HttpKernel\EventListener\RouterListener diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml index 2b07dc5136..0c28916e27 100644 --- a/phpBB/config/development/config.yml +++ b/phpBB/config/development/config.yml @@ -12,6 +12,7 @@ core: memory: true show_errors: true url_generator: true + url_matcher: true twig: debug: true diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index 0e68ad29e7..f98c9d817c 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -41,6 +41,7 @@ class container_configuration implements ConfigurationInterface ->booleanNode('memory')->defaultValue(false)->end() ->booleanNode('show_errors')->defaultValue(false)->end() ->booleanNode('url_generator')->defaultValue(false)->end() + ->booleanNode('url_matcher')->defaultValue(false)->end() ->end() ->end() ->arrayNode('twig') diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php index 09c13a371d..9bd9a6bb36 100644 --- a/phpBB/phpbb/routing/router.php +++ b/phpBB/phpbb/routing/router.php @@ -85,17 +85,23 @@ class router implements RouterInterface */ protected $debug_url_generator; + /** + * @var string + */ + protected $debug_url_matcher; + /** * Construct method * - * @param ContainerInterface $container DI container - * @param resources_locator_interface $resources_locator Resources locator - * @param LoaderInterface $loader Resources loader - * @param string $php_ext PHP file extension - * @param string $cache_dir phpBB cache directory - * @param string $debug_url_generator Debug url generator + * @param ContainerInterface $container DI container + * @param resources_locator_interface $resources_locator Resources locator + * @param LoaderInterface $loader Resources loader + * @param string $php_ext PHP file extension + * @param string $cache_dir phpBB cache directory + * @param string $debug_url_generator Debug url generator + * @param string $debug_url_matcher Debug url matcher */ - public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $php_ext, $cache_dir, $debug_url_generator) + public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, string $php_ext, string $cache_dir, string $debug_url_generator, string $debug_url_matcher) { $this->container = $container; $this->resources_locator = $resources_locator; @@ -104,6 +110,7 @@ class router implements RouterInterface $this->context = new RequestContext(); $this->cache_dir = $cache_dir; $this->debug_url_generator = $debug_url_generator; + $this->debug_url_matcher = $debug_url_matcher; } /** @@ -207,7 +214,7 @@ class router implements RouterInterface { try { - $cache = new ConfigCache("{$this->cache_dir}url_matcher.{$this->php_ext}", defined('DEBUG')); + $cache = new ConfigCache("{$this->cache_dir}url_matcher.{$this->php_ext}", $this->debug_url_matcher); if (!$cache->isFresh()) { $dumper = new PhpMatcherDumper($this->get_routes()); diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index 951741156b..15695735b8 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -151,7 +151,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ 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, 'php', dirname(__FILE__) . '/', true); + $this->router = new phpbb_mock_router($container, $resources_locator, $loader, 'php', dirname(__FILE__) . '/', true, true); $this->auth = new \phpbb\auth\auth(); $this->cache = new \phpbb\cache\driver\dummy(); $this->db = $this->new_dbal(); diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index a3a892bffe..1a36464add 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, 'php', dirname(__FILE__) . '/', true); + $router = new phpbb_mock_router($container, $resources_locator, $loader, 'php', dirname(__FILE__) . '/', true, true); $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 0ed5e34c46..0c920dc9a7 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -42,7 +42,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, 'php', dirname(__FILE__) . '/', true); + $router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, 'php', dirname(__FILE__) . '/', true, true); $request = new phpbb_mock_request(); $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);