note 99463 deleted from security.magicquotes.disabling by danbrown
| From: | danbrown@php.net | Date: | Wed, 18 Aug 2010 23:26:32 +0000 |
| Subject: | note 99463 deleted from security.magicquotes.disabling by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171829@lists.php.net to get a copy of this message | ||
Note Submitter: Alix Axel
----
If you're running PHP 5.3.0+ the following code does exactly the same as the example #2, except
that it is much faster and more elegant:
<?php
if ((get_magic_quotes_gpc() === 1) && (version_compare(PHP_VERSION, '5.3.0',
'>=') === true))
{
$_GET = json_decode(stripslashes(json_encode($_GET, JSON_HEX_APOS | JSON_HEX_QUOT)), true);
$_POST = json_decode(stripslashes(json_encode($_POST, JSON_HEX_APOS | JSON_HEX_QUOT)), true);
$_COOKIE = json_decode(stripslashes(json_encode($_COOKIE, JSON_HEX_APOS | JSON_HEX_QUOT)), true);
$_REQUEST = json_decode(stripslashes(json_encode($_REQUEST, JSON_HEX_APOS | JSON_HEX_QUOT)), true);
}
?>
This code is used by the phunction PHP Framework (http://phunction.sf.net/).