note 95712 added to security.magicquotes.disabling
| From: | AlixAxel at osu1 dot php dot net | Date: | Sun, 17 Jan 2010 18:40:30 +0000 |
| Subject: | note 95712 added to security.magicquotes.disabling | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165055@lists.php.net to get a copy of this message | ||
For PHP 5.3+ users here is a simpler, portable way to work around magic quotes:
<?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);
}
?>
Fixes both keys and values in multi-dimensional arrays without using recursion.
----
Server IP: 81.92.192.129
Probable Submitter: 95.136.126.48
----
Manual Page -- http://www.php.net/manual/en/security.magicquotes.disabling.php
Edit -- https://master.php.net/note/edit/95712
Del: integrated -- https://master.php.net/note/delete/95712/integrated
Del: useless -- https://master.php.net/note/delete/95712/useless
Del: bad code -- https://master.php.net/note/delete/95712/bad+code
Del: spam -- https://master.php.net/note/delete/95712/spam
Del: non-english -- https://master.php.net/note/delete/95712/non-english
Del: in docs -- https://master.php.net/note/delete/95712/in+docs
Del: other reasons-- https://master.php.net/note/delete/95712
Reject -- https://master.php.net/note/reject/95712
Search -- https://master.php.net/manage/user-notes.php