Topic on Project:Support desk

Jump to navigation Jump to search

[RESOLVED] "MediaWiki does not function when magic quotes are enabled" error with magic quotes disabled

7
24.22.215.198 (talkcontribs)

Upgrading from 1.12 to 1.24.1 and I'm receiving

"Exception from line 61 of /public_html/wiki/includes/WebRequest.php: MediaWiki does not function when magic quotes are enabled.

Backtrace:

  1. 0 /public_html/wiki/includes/Setup.php(544): WebRequest->__construct()
  2. 1 /public_html/wiki/includes/WebStart.php(121): require_once(string)
  3. 2 /public_html/wiki/mw-config/index.php(36): require(string)
  4. 3 {main}"

when I attempt to run mw-config/index.php. Magic quotes are off in the php.ini.

Trying to go to the main index just gives a "Fatal exception of type MWException".

I'm running PHP 5.3.27, if that makes a difference, and I've read and tried everything I could find, but I'm not sure what all I can do with only FTP and web access.

Thanks for any advice you can offer.

88.130.108.145 (talkcontribs)

Obviously, at another place, another value is set for magic quotes and that value takes precedence. You will also be able to see that when you check the output of phpinfo() for the value of magic quotes.

The solution will be to make sure, magic quotes are really disabled.

24.22.215.198 (talkcontribs)

Well, there was no problem before the upgrade, when magic quotes were still disabled.

I checked phpinfo and all magic quote entries are listed as "Off" in Local and Master Values.

88.130.108.145 (talkcontribs)

I personally doubt that the MediaWiki source code is wrong at that place. I now checked it anyway and it is correct.

The file includes/WebRequest.php, around line 60 checks for magic quotes:

if ( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ) {
  throw new MWException( "MediaWiki does not function when magic quotes are enabled." );
}

According to the PHP manual, get_magic_quotes_gpc() only returns TRUE, if magic quotes are enabled.

24.22.215.198 (talkcontribs)

And yet it's not. I don't know what to tell you.

I'm just trying to find out if there's other places I can look or anything I can do to fix it before I just delete my whole install and give up on it.

88.130.108.145 (talkcontribs)

You can modify the source code to look this way:

/* Code commented out
if ( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ) {
  throw new MWException( "MediaWiki does not function when magic quotes are enabled." );
}
*/

This will disable the check and MediaWiki will then not fail at that place. Note: If magic quotes are in fact enabled, running a wiki on that system is just downright dangerous.

---

Anyway:

If magic quotes in fact are disabled, get_magic_quotes_gpc() should return 0 and not 1.

So what you report basically is a presumably wrong result of a PHP function. A false-positive so to speak.

If things are the way you tell us, then this is a bug in PHP, which you should report to the PHP bugtracker.

24.22.215.198 (talkcontribs)

Thanks. That helped me narrow down that something was causing my php.ini to not work unless you had it in every folder involved for some unknown reason. So, after I copied it to several more folders, the magic quotes were off in every descending folder... Not sure why the ini settings weren't cascading down to the folders below it, but that at least fixed the issue so I could set up the wiki.

Reply to "[RESOLVED] "MediaWiki does not function when magic quotes are enabled" error with magic quotes disabled"