note 95697 added to function.get-magic-quotes-gpc

From: Date: Sat, 16 Jan 2010 20:20:56 +0000
Subject: note 95697 added to function.get-magic-quotes-gpc
Groups: php.notes 
Request: Send a blank email to php-notes+get-165031@lists.php.net to get a copy of this message
For those of you who need a portable magic quotes antidote here is a solution that fixes both keys and values in multi-dimensional arrays: <?php if (get_magic_quotes_gpc() === 1) { $_GET = json_decode(stripslashes(json_encode($_GET, JSON_HEX_APOS)), true); $_POST = json_decode(stripslashes(json_encode($_POST, JSON_HEX_APOS)), true); $_COOKIE = json_decode(stripslashes(json_encode($_COOKIE, JSON_HEX_APOS)), true); $_REQUEST = json_decode(stripslashes(json_encode($_REQUEST, JSON_HEX_APOS)), true); } ?> Look mum, no recursion! :P Enjoy! ---- Server IP: 194.8.30.16 Probable Submitter: 95.136.126.48 ---- Manual Page -- http://www.php.net/manual/en/function.get-magic-quotes-gpc.php Edit -- https://master.php.net/note/edit/95697 Del: integrated -- https://master.php.net/note/delete/95697/integrated Del: useless -- https://master.php.net/note/delete/95697/useless Del: bad code -- https://master.php.net/note/delete/95697/bad+code Del: spam -- https://master.php.net/note/delete/95697/spam Del: non-english -- https://master.php.net/note/delete/95697/non-english Del: in docs -- https://master.php.net/note/delete/95697/in+docs Del: other reasons-- https://master.php.net/note/delete/95697 Reject -- https://master.php.net/note/reject/95697 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165031) next »