I almost have my Drupal upgraded 4.3RC under Windows (2000). But I am now getting a message that magic_quotes_gpc needs to be set to 0. I cannot remember what I did for 4.2, Dries or someone helped me but I cannot find the notes (I am really thinking of moving this back to Linux or FreeBSD out of frustration).

Support and the Webhosting site tells me:

You may alter magic_quotes_gpc value by using following functions in your scripts, e.g. ini_set("magic_quotes_gpc","0"); You are using windows account, so there is no .htaccess options. We unable to alter global setting, because it will affect another accounts and may cause some service scripts to crash. Thank you for understanding us in this matter.

If this is the only way to do it, where is the best place to put this command? index.php?

Any help would be appreciated!
----Martin----

Comments

kloeschen’s picture

I thing the best place is at the beginning of index.php or common.inc.
But drupal also work with magic_quotes:

set_magic_quotes_runtime(0);

if (get_magic_quotes_gpc ()) {
array_stripslashes($_POST);
array_stripslashes($_GET);
array_stripslashes($_COOKIES);
}

function array_stripslashes(&$array)
{
if (is_array($array))
while (list($key) = each($array))
{
if (is_array($array[$key]))
{
array_stripslashes($array[$key]);
}
else 
{
$array[$key] = stripslashes($array[$key]);
}
}
}

put this in the common.inc (beginning) and disable the check in index.php:
#check_php_setting("magic_quotes_gpc", 0);
--
German Translation in progress

killes@www.drop.org’s picture

The best place for config stuff is obviously conf.php.

cel4145’s picture

you might want to point your host to this page on ini.set at php.net. the comments in the discussion of the page suggest that while you can set it with ini.set, the php scripts will still use the global defaults. i encountered this problem with a previous hosting service; ended up having to switch hosts. if i remember correctly, the local settings even show up as being correct with phpinfo(); they just don't work properly.