views:

442

answers:

6

My crappy web host did some upgrades the other day and some settings have gone awry, because looking at our company's wiki (MediaWiki), every quote is being escaped with a backslashes. It's not even just data which is being posted (ie: the articles) which are affected, but also the standard MediaWiki text. eg:

You\'ve followed a link to a page that doesn\'t exist yet. To create the page, start typing in the box below (see the help page for more info). If you are here by mistake, just click your browser\'s \'\'\'back\'\'\' button.

The first thing I did was disable magic_quotes_gpc AND magic_quotes_runtime using a .htaccess file, but this is still occurring. My php_info() reports this:

Setting             Local Value   Master Value  
magic_quotes_gpc        Off            On  
magic_quotes_runtime    Off            On  
magic_quotes_sybase     Off            Off

Any ideas?

A: 

Perhaps something else is calling set_magic_quotes_runtime().

Andy Lester
+1  A: 

You'll need to get them to change the master value, or handle it yourself. I don't believe you can set magic_quotes_gpc() at runtime for super globals. (setting it at runtime will strip things like database/files, but not the globals)

if (ini_get('magic_quotes_gpc') ) {
  foreach($_GET as $key=>$value) {
    $_GET[$key] = stripslashes($value);
  } 
} // etc...
Owen
this doesn't have anything to do with register globals. Setting the php_flag via .htaccess isn't "runtime" either, i thought.
nickf
er oops i mean magic_quotes_gpc, which is ini_perdir (virtual host/php.ini), so .htaccess wouldn't work on that
Owen
Tom Haigh
+4  A: 

You may want to confirm that the data in your DB hasn't been corrupted. If you were addslash()ing your data when, unbeknownst to you, magic_quotes had been turned on, then you'd be double-slashifying data going into your DB.

Lucas Oman
+1  A: 

If PHP flags are set with php_admin_flag/php_admin_value, you can't change it from a .htaccess file. This has caused me some headache before. Either disable it in php.ini or undo magic quotes in runtime: http://talks.php.net/show/php-best-practices/26

troelskn
A: 

Have you tried contacting your crappy host and logging a fault? You're probably not the only one affected if you are on shared hosting.

MDCore
A: 

I use stripslases() to remove slashes when displaying.

http://www.php.net/manual/en/function.stripslashes.php

Tim