get_magic_quotes_gpc function gets the current configuration setting of magic_quotes_gpc
magic_quotes_gpc function is used to set the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ‘ (single-quote), ” (double quote), \ (backslash), and NULL’s are escaped with a backslash automatically.
This feature(magic_quotes_gpc) has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
get_magic_quotes_gpc function also DEPRECATED as of PHP 7.4.0, and REMOVED as of PHP 8.0.0. Relying on this function is highly discouraged. So, we can just remove this code while migrating the code to PHP 8.x, or you can create this function and put your custom code. Like this:
<?php
function AamStripSlashes( $str )
{
if( function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc() )
{
return stripslashes($str);
} else {
return ($str);
}
}
if( !function_exists("get_magic_quotes_gpc") )
{
function get_magic_quotes_gpc()
{
return true;
}
}
?>
Solution
Comment the code or check the function exits, like this:
<?php
if( function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc() )
{
return stripslashes($str);
} else {
return ($str);
}
?>
Leave a Reply
You must be logged in to post a comment.