phpdeprecated

How to replace get_magic_quotes_runtime() in PHP7.4


The function get_magic_quotes_runtime is deprecated in PHP 7.4 as per documantation.

This function has been DEPRECATED as of PHP 7.4.0. Relying on this function is highly discouraged.

How to replace it with a valid code with the same functionality?

A particular example PunBB v1.4.5, file: common.php line 18:

// Turn off magic_quotes_runtime
if (get_magic_quotes_runtime()) {
    @ini_set('magic_quotes_runtime', false);
}

Solution

  • Well it is a reference to magic_quotes_runtime which is itself deprecated as of PHP 5.3 and REMOVED in PHP 5.4 so you have no need to use get_magic_quotes_runtime in PHP 7.4

    So you can simply update your code accordingly:

    /***
     * Turn off magic_quotes_runtime
     * this function serves no purpose
    if (get_magic_quotes_runtime()) {
        @ini_set('magic_quotes_runtime', false);
    }
    ***/
    

    Edit: This is just an example, you can simply delete your shown code ;-)