[pmwiki-users] Selecting a Wiki engine...
Thomas -Balu- Walter
list+pmwiki-users at b-a-l-u.de
Mon Oct 16 09:19:47 CDT 2006
On Fri, Oct 06, 2006 at 07:17:09PM +0200, Joachim Durchholz wrote:
> Some can, some can't.
> E.g. you can't undo the effect of magic_quotes_gpc in $_REQUEST.
Just to make sure that all can ;) - also works with $_REQUEST:
<?php
// strip magic quotes from Superglobals...
if ((bool) get_magic_quotes_GPC()) { // by "php Pest"
// Really EGPCSR - Environment $_ENV, GET $_GET , POST $_POST, Cookie $_COOKIE, Server $_SERVER
// and their HTTP_*_VARS cousins (separate arrays, not references) and $_REQUEST
$fnStripMagicQuotes = create_function(
'&$mData, $fnSelf',
'if (is_array($mData)) { foreach ($mData as $mKey=>$mValue) $fnSelf($mData[$mKey], $fnSelf); return; } '.
'$mData = stripslashes($mData);'
);
$fnStripMagicQuotes($_POST, $fnStripMagicQuotes); // do each set of EGPCSR as you find necessary
$fnStripMagicQuotes($_GET, $fnStripMagicQuotes);
$fnStripMagicQuotes($_REQUEST, $fnStripMagicQuotes);
}
var_dump($_REQUEST['a']);
phpinfo();
?>
I'm using this snippet now for a while at the start of each script and had no
problems so far.
Balu
More information about the pmwiki-users
mailing list