From dd8191404de23682e9771abcb3c69bf58a3b70ed Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 18 Jul 2021 09:55:08 +0200 Subject: [PATCH] [ticket/16207] Stop appending ? to build_url URLs if not needed PHPBB3-16207 --- phpBB/includes/functions.php | 2 +- tests/functions/build_url_test.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9b303e4647..b4709544cf 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1835,7 +1835,7 @@ function build_url($strip_vars = false) $redirect = str_replace('&', '&', $redirect); } - return $redirect . ((strpos($redirect, '?') === false) ? '?' : ''); + return $redirect; } /** diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index bc775d87ec..db9ce2964a 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -39,12 +39,12 @@ class phpbb_build_url_test extends phpbb_test_case array( 'index.php', false, - 'phpBB/index.php?', + 'phpBB/index.php', ), array( 'index.php', 't', - 'phpBB/index.php?', + 'phpBB/index.php', ), array( 'viewtopic.php?t=5&f=4', @@ -59,12 +59,12 @@ class phpbb_build_url_test extends phpbb_test_case array( 'viewtopic.php?f=2&style=1&t=6', array('f', 'style', 't'), - 'phpBB/viewtopic.php?', + 'phpBB/viewtopic.php', ), array( 'http://test.phpbb.com/viewtopic.php?f=2&style=1&t=6', array('f', 'style', 't'), - 'http://test.phpbb.com/viewtopic.php?', + 'http://test.phpbb.com/viewtopic.php', ), array( 'posting.php?f=2&mode=delete&p=20%22%3Cscript%3Ealert%281%29%3B%3C%2Fscript%3E',