Dmitro
Dmitro

Reputation: 1549

PHP 7.0 get_magic_quotes_runtime error

I have code like that:

    if (function_exists('get_magic_quotes_runtime')) {
        $mqr = @get_magic_quotes_runtime();
        @set_magic_quotes_runtime(0);
    }

And when it is executed It returns error message: Uncaught Error: Call to undefined function set_magic_quotes_runtime()

But why function_exists('get_magic_quotes_runtime') returns true? Is it normal for PHP 7.0?

Upvotes: 5

Views: 30223

Answers (3)

iainn
iainn

Reputation: 17417

get_magic_quotes_runtime has returned false since PHP 5.4, was marked deprecated in 7.4, and was removed from the language in 8.0

set_magic_quotes_runtime has been deprecated since 5.3, and was removed from the language in 7.0.

In short, you probably absolutely shouldn't have the words "magic quotes" anywhere in your code any more, they haven't had any functional effect in roughly a decade.

Upvotes: 9

SebaZ
SebaZ

Reputation: 31

Change all

set_XXXX functions like set_magic_quotes_runtime

to

ini_set('magic_quotes_runtime', 0);

Upvotes: 2

Jakub Matczak
Jakub Matczak

Reputation: 15656

Please note that the error relates to set_magic_quotes_runtime, not get_magic_quotes_runtime function.

get_magic_quotes_runtime still exists in PHP7 but set_magic_quotes_runtime was removed in 7.0.

Upvotes: 0

Related Questions