php-general Digest 24 Oct 2010 22:29:50 -0000 Issue 7004
Topics (messages 309044 through 309044):
Stripslashes redundancy question.
309044 by: Gary
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
In my form processing scripts, I usually have the variable set as so:
$email = stripslashes($_POST['email']);
I have discovered that the program that I use has a pre-written function of
this:
// remove escape characters from POST array
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
}
I just put this in a script that I have been using, leaving the original
stripslashes in the variable. The script still works, but is there a problem
with redundancy, or does one cancel the other out?
Also, which do you think is a better method to use?
Thank you
Gary
__________ Information from ESET Smart Security, version of virus signature
database 5560 (20101024) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--- End Message ---