1

I have thousands of instances of calls to get_magic_quotes_gpc. Since get_magic_quotes_gpc is going away, I found a recommendation to simply replace call with "false".

Then the code:

if (get_magic_quotes_gpc()) {
    $cell = stripslashes($cell);
}

would become:

if (false) {
    $cell = stripslashes($cell);
}

This would require finding and replacing each instance.

I have made a few updates to test the one-at-time solution but is there a bulk or universal solution or do I have to hire additional programmers to sift thru the files? Otherwise when PHP V8 comes along, there are going to be a lot crashes.

Koala Yeung
  • 7,475
  • 3
  • 30
  • 50

2 Answers2

5

You could always define your own replacement function in a globally included file...

if (!function_exists('get_magic_quotes_gpc')) {
    function get_magic_quotes_gpc() {
        return false;
    }
}

https://3v4l.org/9C6Ui

Phil
  • 157,677
  • 23
  • 242
  • 245
4

Can be done in a single shell command:


$ sed -i 's/get_magic_quotes_gpc()/false/g' *

Or, to apply this only to .php files:


find . -type f -name '*.php' -print0 | xargs -0 sed -i 's/get_magic_quotes_gpc()/false/g' *

cp1
  • 163
  • 6