Skip to content

Commit b0c7155

Browse files
committed
Fix preserving query strings for error page redirects
1 parent fc22b37 commit b0c7155

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

error.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
// Get URI for this request, strip leading slash
2020
// See langchooser.inc for more info on STRIPPED_URI
2121
$URI = substr($_SERVER['STRIPPED_URI'], 1);
22-
$queryString = $_SERVER['QUERY_STRING'] ?? '';
22+
$uriParts = explode('?', $URI, 2);
23+
$URI = $uriParts[0];
24+
$queryString = isset($uriParts[1]) ? html_entity_decode($uriParts[1], ENT_QUOTES, 'UTF-8') : '';
2325

2426
// ============================================================================
2527
// Mozilla Search Sidebar plugin resource file handling (need to be mirror
@@ -38,8 +40,8 @@
3840

3941
// ============================================================================
4042
// BC: handle bugs.php moved completely to bugs.php.net
41-
if (preg_match("!^bugs.php\\?(.+)$!", $URI, $array)) {
42-
mirror_redirect("https://bugs.php.net/?$array[1]");
43+
if ($URI === 'bugs.php' && $queryString !== '') {
44+
mirror_redirect("https://bugs.php.net/?$queryString");
4345
}
4446

4547
// ============================================================================

0 commit comments

Comments
 (0)