aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Darricau <tristan.darricau@sensiolabs.com>2016-03-27 19:59:15 +0200
committerTristan Darricau <tristan.darricau@sensiolabs.com>2016-03-29 19:06:37 +0200
commit0b1ed8dbbb3792b97726282fdc630cc242def2ad (patch)
tree939e53a92ba86b69f9e88e91fe8430fe5bf23df3
parent1a5fbd4bd06e7ae7a89637c0977da2fed8cd62fb (diff)
downloadforums-0b1ed8dbbb3792b97726282fdc630cc242def2ad.tar
forums-0b1ed8dbbb3792b97726282fdc630cc242def2ad.tar.gz
forums-0b1ed8dbbb3792b97726282fdc630cc242def2ad.tar.bz2
forums-0b1ed8dbbb3792b97726282fdc630cc242def2ad.tar.xz
forums-0b1ed8dbbb3792b97726282fdc630cc242def2ad.zip
[ticket/13683] Fix more cases
PHPBB3-13683
-rw-r--r--phpBB/phpbb/controller/helper.php7
-rw-r--r--tests/controller/common_helper_route.php2
2 files changed, 5 insertions, 4 deletions
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index 75b7515540..dbf7a9307a 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -143,12 +143,13 @@ class helper
$context = new RequestContext();
$context->fromRequest($this->symfony_request);
- if ($this->config['force_server_vars']) {
+ if ($this->config['force_server_vars'])
+ {
$context->setHost($this->config['server_name']);
$context->setScheme(substr($this->config['server_protocol'], -4));
$context->setHttpPort($this->config['server_port']);
$context->setHttpsPort($this->config['server_port']);
- $context->setBaseUrl($this->config['script_path'] . '/app.php');
+ $context->setBaseUrl($this->config['script_path']);
}
$script_name = $this->symfony_request->getScriptName();
@@ -166,7 +167,7 @@ class helper
$base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url);
// We need to update the base url to move to the directory of the app.php file if the current script is not app.php
- if ($page_name !== 'app.php')
+ if ($page_name !== 'app.php' && !$this->config['force_server_vars'])
{
if (empty($this->config['enable_mod_rewrite']))
{
diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php
index 66fb29caf8..b3ec8b256a 100644
--- a/tests/controller/common_helper_route.php
+++ b/tests/controller/common_helper_route.php
@@ -427,7 +427,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
*/
public function test_helper_url_network_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
{
- $this->config = new \phpbb\config\config(['enable_mod_rewrite' => '1']);
+ $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
$helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
static::assertEquals($expected, $helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description);
}