note 28269 deleted from function.set-magic-quotes-runtime by didou

From: Date: Thu, 29 May 2003 21:46:56 +0000
Subject: note 28269 deleted from function.set-magic-quotes-runtime by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-49338@lists.php.net to get a copy of this message
Note Submitter: ramen@ramenfest.com ---- 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);

« previous php.notes (#49338) next »