Skip to content

Commit 682533e

Browse files
committed
Fix case-insensitive handling of .php extensions
1 parent f1cc5da commit 682533e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎public/error.php‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@
181181
mirror_redirect("https://github.com/php/php-src/issues/" . $matches[1]);
182182
}
183183

184-
// php.net/supported-versions.PHP -> supported-versions.php
185-
if ($URI == 'supported-versions.PHP') {
186-
mirror_redirect("https://www.php.net/supported-versions.php");
187-
}
188-
184+
// Fix for case-insensitive .php extension, e.g. /supported-versions.PHP, /downloads.PHP
185+
$URI = preg_replace_callback(
186+
'/\.php\z/i',
187+
static fn($match) => strtolower($match[0]),
188+
$URI
189+
);
189190

190191
// ============================================================================
191192
// Redirect if the entered URI was a PHP page name (except some pages,

0 commit comments

Comments
 (0)