From f5c2119e7cd0359614300be9a2bd116965a1ec7c Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 11 Jul 2013 18:13:48 -0400 Subject: [PATCH] [ticket/11647] Always use & for URLs Remove code for URLs separated with ; Add test case for mix of & and & in URLs PHPBB3-11647 --- phpBB/includes/template/asset.php | 5 ++--- tests/template/template_includejs_test.php | 14 +++++--------- tests/template/templates/includejs.html | 6 ++---- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/phpBB/includes/template/asset.php b/phpBB/includes/template/asset.php index 99ac1f0ca7..7c322cd971 100644 --- a/phpBB/includes/template/asset.php +++ b/phpBB/includes/template/asset.php @@ -40,7 +40,7 @@ class phpbb_template_asset { // Workaround for PHP 5.4.6 and older bug #62844 - add fake scheme and then remove it $this->components = parse_url('http:' . $url); - unset($this->components['scheme']); + $this->components['scheme'] = ''; return; } $this->components = parse_url($url); @@ -176,8 +176,7 @@ class phpbb_template_asset $query = $this->components['query']; if (!preg_match('/(^|[&;])assets_version=/', $query)) { - $separator = (strpos($query, '&') === false) && (strpos($query, ';') !== false) && preg_match('/^.*=.*;.*=.*$/', $query) ? ';' : '&'; - $this->components['query'] = $query . $separator . 'assets_version=' . $version; + $this->components['query'] = $query . '&assets_version=' . $version; } } } diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 7616b278d6..b67fa123a1 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -30,16 +30,12 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes ), array( array('TEST' => 3), - '', + '', ), array( array('TEST' => 4), '', ), - array( - array('TEST' => 5), - '', - ), array( array('TEST' => 6), '', @@ -68,10 +64,6 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes array('TEST' => 12), '', ), - array( - array('TEST' => 13), - '', - ), array( array('TEST' => 14), '', @@ -88,6 +80,10 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes array('TEST' => 17), '', ), + array( + array('TEST' => 18), + '', + ), ); } diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html index 2e2c52c857..0bcdf1a815 100644 --- a/tests/template/templates/includejs.html +++ b/tests/template/templates/includejs.html @@ -6,8 +6,6 @@ - - @@ -24,8 +22,6 @@ - - @@ -34,5 +30,7 @@ + + {$SCRIPTS}