How can the use of magic_quotes_gpc affect the functionality of a PHP script, especially in the context of PHP 5.3?

When magic_quotes_gpc is enabled in PHP, it automatically escapes incoming data from forms, which can lead to double escaping and unexpected behavior in scripts. To address this issue in PHP 5.3, you can check if magic_quotes_gpc is enabled and then remove the slashes from the input data using the stripslashes() function.

if(get_magic_quotes_gpc()){
  $_POST = array_map('stripslashes', $_POST);
  $_GET = array_map('stripslashes', $_GET);
  $_COOKIE = array_map('stripslashes', $_COOKIE);
}