diff --git a/common.inc.php b/common.inc.php index fd6ff10d..242c5844 100644 --- a/common.inc.php +++ b/common.inc.php @@ -169,6 +169,29 @@ if($dbcodeversion!=$dbdbversion) exit; } +/* Check that magic_quotes is OFF */ +if(get_magic_quotes_gpc()) { +?> + SFIAB ERROR +

Science Fair In A Box - ERROR

+

Your PHP configuration has magic_quotes ENABLED. They should be + disabled, and are disabled in the .htaccess file, so your server is + ignoring the .htaccess file or overriding it. +

Magic quotes is DEPRECATED as of PHP 5.3.0, REMOVE as of 6.0, but ON + by default for any PHP < 5.3.0. +

It's a pain in the butt because PHP runs urldecode() on all inputs + from GET and POST, but if it sees the string has quotes, then it escapes + existing quotes before passing it to us. This is a problem for json_decode + where we do not want this behaviour, and thus need to pass through stripslashes() + first, but only if magicquotes is ON. If it's off, stripslashes will + break json_decode. +

Add

php_flag magic_quotes_gpc off
to the .htacces, or add +
php_flag magic_quotes_gpc=off
to php.ini + +
+