note 99463 added to security.magicquotes.disabling

From: Date: Wed, 18 Aug 2010 21:07:08 +0000
Subject: note 99463 added to security.magicquotes.disabling
Groups: php.notes 
Request: Send a blank email to php-notes+get-171823@lists.php.net to get a copy of this message
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/). ---- Server IP: 194.8.30.16 Probable Submitter: 95.136.98.19 ---- Manual Page -- http://www.php.net/manual/en/security.magicquotes.disabling.php Edit -- https://master.php.net/note/edit/99463 Del: integrated -- https://master.php.net/note/delete/99463/integrated Del: useless -- https://master.php.net/note/delete/99463/useless Del: bad code -- https://master.php.net/note/delete/99463/bad+code Del: spam -- https://master.php.net/note/delete/99463/spam Del: non-english -- https://master.php.net/note/delete/99463/non-english Del: in docs -- https://master.php.net/note/delete/99463/in+docs Del: other reasons-- https://master.php.net/note/delete/99463 Reject -- https://master.php.net/note/reject/99463 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#171823) next »