note 28240 added to function.set-magic-quotes-runtime

From: Date: Mon, 06 Jan 2003 23:29:53 +0000
Subject: note 28240 added to function.set-magic-quotes-runtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-41763@lists.php.net to get a copy of this message
Gnarf's useful "remove_magic_quotes" function can be enhanced to account for "magic_quotes_sybase" and "magic_quotes_runtime", which, according to http://www.php.net/manual/en/ref.sybase.php, can completely override "magic_quotes_gpc". remove_magic_quotes(&$HTTP_GET_VARS); remove_magic_quotes(&$HTTP_POST_VARS); remove_magic_quotes(&$HTTP_COOKIE_VARS); remove_magic_quotes(&$HTTP_SESSION_VARS); ini_set("magic_quotes_gpc", 0); ini_set("magic_quotes_sybase", 0); ini_set("magic_quotes_runtime", 0); function remove_magic_quotes(&$x) { if (is_array($x)) { while (list($key,$value) = each($x)) { if ($value) remove_magic_quotes(&$x[$key]); } } else if (ini_get('magic_quotes_sybase')) { $x = preg_replace("/''/", "'", $x); } else if (ini_get('magic_quotes_runtime')) { $x = preg_replace("/\\\"/", '"', $x); } else if (ini_get('magic_quotes_gpc')) { $x = stripslashes($x); } } This version also uses HTTP_*_VARS for slightly more backwards compatability and passes variables by reference for efficiency. -- http://www.php.net/manual/en/function.set-magic-quotes-runtime.php http://master.php.net/manage/user-notes.php?action=edit+28240 http://master.php.net/manage/user-notes.php?action=delete+28240 http://master.php.net/manage/user-notes.php?action=reject+28240

« previous php.notes (#41763) next »