ok, since upcoming PHP6 will be dropping support for magic_quotes, I am going to retool a textfield's $_POST handling...
but first, I should really get the understanding straight..
We should no longer support the function get_magic_quotes_gpc() , correct?
so if I have:
if(get_magic_quotes_gpc()){
$_POST['textarea'] = stripslashes($_POST['textarea']);
}
Am I correct in assuming that since stripslashes() relies on the PHP directive magic_quotes_gpc to being on, this means that this particular function will be null and void as well?
If so, I am confused...I was reading on some of the responses posted in php manual regarding the issue of get_magic_quotes_gpc:
One respondant wrote:
'Just for the record. this feature has been removed as of PHP6.
now PHP works always like if magic_quotes_gpc Off.
get_magic_quotes_gpc, get_magic_quotes_runtime are kept but always return false, set_magic_quotes_runtime raises an E_CORE_ERROR.'
But someone in that thread posted an apparent alternative. The link is:
http://talks.php.net/show/php-best-practices/26
In the last code sample in that link (which is apparently a better way to go) is as follows:
if (get_magic_quotes_gpc()) {
$in = array(&$_GET, &$_POST, &$_COOKIE);
while (list($k,$v) = each($in)) {
foreach ($v as $key => $val) {
if (!is_array($val)) {
$in[$k][$key] = stripslashes($val);
continue;
}
$in[] =& $in[$k][$key];
}
}
unset($in);
}
But if I am correct in understanding that stripslashes relies on get_magic_quotes_gpc, which is going to be kept but return false (according to the user I quoted above), then would this not render the above code's line:
$in[$k][$key] = stripslashes($val);
obsolete?
I'm terribly confused
Cheers,
NRG