com web/php: move $URI.php test higher up in error.php (phpweb bug #67871): error.php
| From: | Peter Cowburn | Date: | Wed, 20 Aug 2014 21:03:39 +0000 |
| Subject: | com web/php: move $URI.php test higher up in error.php (phpweb bug #67871): error.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-19733@lists.php.net to get a copy of this message | ||
Commit: 1f4a628d844aec530de87aa8c574ce00d3aeb48a
Author: Peter Cowburn <salathe@php.net> Wed, 20 Aug 2014 22:03:39 +0100
Parents: 3ca803e13aaff7e9cdff5469e947cc017f50a5a2
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=1f4a628d844aec530de87aa8c574ce00d3aeb48a
Log:
move $URI.php test higher up in error.php (phpweb bug #67871)
This test was below (way below) the $URI = strtolower($URI) line, so
when browsing to /manual/pt_BR/function.strpos we were looking for
/manual/pt_br/function.strpos.php which doesn't exist (on case-sensitive
filesystems).
Note: This is a quick fix... if it causes (significant) issues, we might
have to think of a more involved solution than shuffling the code up the
file by a few hundred lines.
Bugs:
https://bugs.php.net/67871
Changed paths:
M error.php
Diff:
diff --git a/error.php b/error.php
index 4a9ef61..2931155 100644
--- a/error.php
+++ b/error.php
@@ -189,6 +189,17 @@ if (preg_match("!^get/([^/]+)/from/([^/]+)(/mirror)?$!", $URI,
$dlinfo)) {
if (is_numeric($URI)) {
mirror_redirect("http://bugs.php.net/bug.php?id=$URI");
}
+
+// ============================================================================
+// Redirect if the entered URI was a PHP page name (except some pages,
+// which we display in the mirror's language or the explicitly specified
+// language [see below])
+if (!in_array($URI, array('mirror-info', 'error', 'mod')) &&
+ file_exists($_SERVER['DOCUMENT_ROOT'] . "/$URI.php")) {
+ echo($_SERVER['DOCUMENT_ROOT'] . "/$URI.php");
+exit;
+ mirror_redirect("/$URI.php");
+}
// Work with lowercased URI from now
$URI = strtolower($URI);
@@ -486,15 +497,6 @@ if (isset($uri_aliases[$URI])) {
}
// ============================================================================
-// Redirect if the entered URI was a PHP page name (except some pages,
-// which we display in the mirror's language or the explicitly specified
-// language [see below])
-if (!in_array($URI, array('mirror-info', 'error', 'mod')) &&
- file_exists($_SERVER['DOCUMENT_ROOT'] . "/$URI.php")) {
- mirror_redirect("/$URI.php");
-}
-
-// ============================================================================
// Execute external redirect if a rule exists for the URI
if (isset($external_redirects[$URI])) {
mirror_redirect($external_redirects[$URI]);