note 95697 deleted from function.get-magic-quotes-gpc by salathe

From: Date: Fri, 05 Jun 2015 09:48:03 +0000
Subject: note 95697 deleted from function.get-magic-quotes-gpc by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-202752@lists.php.net to get a copy of this message
Note Submitter: Alix Axel ---- 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!

« previous php.notes (#202752) next »