From bed65d358b551a4576679b8e7714c2e9bb66e037 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Sun, 25 Jan 2009 01:31:48 +0000 Subject: [PATCH] More helpful error message if PHP_SELF isn't set Raw page access was failing in some server configurations with CGI (or in my case, FastCGI). This gives a nicer and more correct error message. Possibly better solutions: 1) Figure out how to do this without PHP_SELF. 2) Give a warning or error on installation, or even on every page view, since this will break all raw page viewing. I ran into this when doing a file copy of my wiki install to another site, FWIW. Even with the new error message, I'd have had to look at the CSS files to figure out what the problem was (the user-visible symptom was that custom styles didn't work). --- RELEASE-NOTES | 1 + includes/RawPage.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b1ac48c90c..24c52b430a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -59,6 +59,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added optional alternative Search form look - Go button & Advanced search link instead of Go button & Search button * (bug 2314) Add links to user custom CSS and JS to Special:Preferences +* More helpful error message on raw page access if PHP_SELF isn't set === Bug fixes in 1.15 === * (bug 16968) Special:Upload no longer throws useless warnings. diff --git a/includes/RawPage.php b/includes/RawPage.php index b16b8fab8a..b422d49ee3 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -127,6 +127,15 @@ class RawPage { $url = $_SERVER['PHP_SELF']; } + if( $url == '' ) { + # This will make the next check fail with a confusing error + # message, so we should mention it separately. + wfHttpError( 500, 'Internal Server Error', + "\$_SERVER['PHP_SELF'] is not set. Perhaps you're using CGI" . + " and haven't set cgi.fix_pathinfo = 1 in php.ini?" ); + return; + } + if( strcmp( $wgScript, $url ) ) { # Internet Explorer will ignore the Content-Type header if it # thinks it sees a file extension it recognizes. Make sure that -- 2.20.1