erikdubbelboer / phpRedisAdmin

Simple web interface to manage Redis databases.
http://dubbelboer.com/phpRedisAdmin/
3.11k stars 666 forks source link

Remove usage of get_magic_quotes_gpc method #158

Closed mvorisek closed 4 years ago

mvorisek commented 4 years ago

get_magic_quotes_gpc() method is deprecated and as of PHP 5.4 it returns false (i.e. the code inside the condition was never reached) - see https://www.php.net/manual/en/function.get-magic-quotes-gpc.php

This PR fixes PHP deprecation warning for PHP 7.4.

erikdubbelboer commented 4 years ago

But this would mean people using a PHP version before 5.4 won't be able to use phpRedisAdmin properly.

The idea of function_exists('get_magic_quotes_gpc') is that this code will still work even if the function gets removed in the future.

I guess a better fix for the deprecation warning is to just add an @ to silence it.

mvorisek commented 4 years ago

@erikdubbelboer Yes, but as the PHP with version lower than 5.4 version is no longer supported by almost any other, I would rather advise to remove this part of the code.

See https://www.php.net/eol.php - last release of PHP 5.3 was in 2014

erikdubbelboer commented 4 years ago

I'm afraid that there is still lots of people and shared hosts using 5.4.

Adding an @ before get_magic_quotes_gpc() is a simple solution that makes it work for everyone. I don't see why we shouldn't do that?

mvorisek commented 4 years ago

I'm afraid that there is still lots of people and shared hosts using 5.4.

Citiing from PHP man:

5.4.0+ Always returns FALSE because the magic quotes feature was removed from PHP.

so PHP 5.4 user are not affected.

Adding an @ before get_magic_quotes_gpc() is a simple solution that makes it work for everyone. I don't see why we shouldn't do that?

the only affected users are with PHP 5.3 and lower with magic quotes enabled. I would say there is no need to support this very old PHP in preference of maintable code. But the @ operator before the function call will solve this issue, I am leaving this up to you to deside.

erikdubbelboer commented 4 years ago

Ok lets merge this. I'm usually also in favor of less code. We can always change it if lots of people complain.