I\'m writing a app that needs to be portable. I know I should disable magic quotes on the PHP configuration but in this case I don\'t know if I can do that, so I\'m using th
Solved it, I had to use the JSON_HEX_APOS flag in json_encode():
if (get_magic_quotes_gpc() === 1)
{
$_GET = json_decode(stripslashes(json_encode($_GET, JSON_HEX_APOS)), true);
}
Before (mqgpc.php?name[got'cha]=O'Reilly):
Array
(
[name] => Array
(
[got\'cha] => O\'Reilly
)
)
After (mqgpc.php?name[got'cha]=O'Reilly):
Array
(
[name] => Array
(
[got'cha] => O'Reilly
)
)