diff options
author | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-07-11 18:13:48 -0400 |
---|---|---|
committer | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-07-11 18:13:48 -0400 |
commit | f5c2119e7cd0359614300be9a2bd116965a1ec7c (patch) | |
tree | 49d6a7e2cf35d826ed0780bdcf0d3090e9651b7c | |
parent | 94fc0cccdc49962e3111e291de8800a0d2d50837 (diff) | |
download | forums-f5c2119e7cd0359614300be9a2bd116965a1ec7c.tar forums-f5c2119e7cd0359614300be9a2bd116965a1ec7c.tar.gz forums-f5c2119e7cd0359614300be9a2bd116965a1ec7c.tar.bz2 forums-f5c2119e7cd0359614300be9a2bd116965a1ec7c.tar.xz forums-f5c2119e7cd0359614300be9a2bd116965a1ec7c.zip |
[ticket/11647] Always use & for URLs
Remove code for URLs separated with ;
Add test case for mix of & and & in URLs
PHPBB3-11647
-rw-r--r-- | phpBB/includes/template/asset.php | 5 | ||||
-rw-r--r-- | tests/template/template_includejs_test.php | 14 | ||||
-rw-r--r-- | 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,17 +30,13 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes ), array( array('TEST' => 3), - '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0"></script>', + '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0"></script>', ), array( array('TEST' => 4), '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0"></script>', ), array( - array('TEST' => 5), - '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1;assets_version=0"></script>', - ), - array( array('TEST' => 6), '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?assets_version=1"></script>', ), @@ -69,10 +65,6 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1&test2=2&assets_version=1#test3"></script>', ), array( - array('TEST' => 13), - '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1;test2=2;assets_version=1#test3"></script>', - ), - array( array('TEST' => 14), '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1="&assets_version=1#test3"></script>', ), @@ -88,6 +80,10 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes array('TEST' => 17), '<script type="text/javascript" src="//phpbb.com/b.js"></script>', ), + array( + array('TEST' => 18), + '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&test2=0&assets_version=1"></script>', + ), ); } 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 @@ <!-- INCLUDEJS parent_and_child.js?test=1&assets_version=0 --> <!-- ELSEIF TEST === 4 --> <!-- INCLUDEJS parent_and_child.js?test=1&assets_version=0 --> -<!-- ELSEIF TEST === 5 --> - <!-- INCLUDEJS parent_and_child.js?test=1;assets_version=0 --> <!-- ELSEIF TEST === 6 --> <!-- INCLUDEJS {PARENT} --> <!-- ELSEIF TEST === 7 --> @@ -24,8 +22,6 @@ <!-- INCLUDEJS {$TEST} --> <!-- ELSEIF TEST === 12 --> <!-- INCLUDEJS parent_only.js?test1=1&test2=2#test3 --> -<!-- ELSEIF TEST === 13 --> - <!-- INCLUDEJS parent_only.js?test1=1;test2=2#test3 --> <!-- ELSEIF TEST === 14 --> <!-- INCLUDEJS parent_only.js?test1="#test3 --> <!-- ELSEIF TEST === 15 --> @@ -34,5 +30,7 @@ <!-- INCLUDEJS http://phpbb.com/b.js?c=d&assets_version=2#f --> <!-- ELSEIF TEST === 17 --> <!-- INCLUDEJS //phpbb.com/b.js --> +<!-- ELSEIF TEST === 18 --> + <!-- INCLUDEJS parent_and_child.js?test=1&test2=0 --> <!-- ENDIF --> {$SCRIPTS} |