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

From: Date: Wed, 08 Jan 2003 01:17:35 +0000
Subject: note 28269 added to function.set-magic-quotes-runtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-41806@lists.php.net to get a copy of this message
gnarf, your code gave me a screenful of warnings about accessing uninitialized variables (I use error_reporting(E_ALL) for all of my testing). The following code does what you intended, but it doesn't generate any warnings (to my knowledge) and also avoids the use of eval, which makes it cleaner and probably faster. Thanks for your tip, though; it saved me some time! Hope this will be helpful to someone else... Peace, Dave function remove_magic_quotes(&$array) { foreach (array_keys($array) as $key) { if (is_array($array[$key])) { remove_magic_quotes($array[$key]); } else { $array[$key] = stripslashes($array[$key]); } } } if (get_magic_quotes_gpc()) { remove_magic_quotes($_GET); remove_magic_quotes($_POST); remove_magic_quotes($_COOKIE); if (isset($_SESSION)) remove_magic_quotes($_SESSION); ini_set('magic_quotes_gpc', 0); } set_magic_quotes_runtime(0); -- http://www.php.net/manual/en/function.set-magic-quotes-runtime.php http://master.php.net/manage/user-notes.php?action=edit+28269 http://master.php.net/manage/user-notes.php?action=delete+28269 http://master.php.net/manage/user-notes.php?action=reject+28269

« previous php.notes (#41806) next »