Revision: 46178
Author:   simetrical
Date:     2009-01-25 01:31:48 +0000 (Sun, 25 Jan 2009)

Log Message:
-----------
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).

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES
    trunk/phase3/includes/RawPage.php

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2009-01-25 01:22:58 UTC (rev 46177)
+++ trunk/phase3/RELEASE-NOTES  2009-01-25 01:31:48 UTC (rev 46178)
@@ -59,6 +59,7 @@
 * 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.

Modified: trunk/phase3/includes/RawPage.php
===================================================================
--- trunk/phase3/includes/RawPage.php   2009-01-25 01:22:58 UTC (rev 46177)
+++ trunk/phase3/includes/RawPage.php   2009-01-25 01:31:48 UTC (rev 46178)
@@ -127,6 +127,15 @@
                        $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



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to