-3

I've never got this error before but now since I am running php 8.1 then this piece of code is obsolete.

// addslashes to vars if magic_quotes_gpc is off
// this is a security precaution to prevent someone
// trying to break out of a SQL statement.
//
//if( !@get_magic_quotes_gpc() ){
ini_set('magic_quotes_runtime', 0);{
    if( is_array($HTTP_GET_VARS) )
    {
        while( list($k, $v) = each($HTTP_GET_VARS) )
        {
            if( is_array($HTTP_GET_VARS[$k]) )
            {
                while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
                {
                    $HTTP_GET_VARS[$k][$k2] = addslashes($v2);
                }
                @reset($HTTP_GET_VARS[$k]);
            }
            else
            {
                $HTTP_GET_VARS[$k] = addslashes($v);
Scott Hunter
  • 48,888
  • 12
  • 60
  • 101
  • 2
    https://www.php.net/manual/en/function.each.php The function was removed. – user3783243 Nov 17 '22 at 13:28
  • 1
    PLease dont put the error message in the title – RiggsFolly Nov 17 '22 at 13:28
  • 1
    Nothing mentioning magic quotes should really be in production anymore. `In November 2005 the core PHP developers decided that because of these problems, the magic quotes feature would be removed from PHP 6`. So 17 years ago that feature was planned to be removed. – user3783243 Nov 17 '22 at 13:32

1 Answers1

0

The each() function has been removed as of PHP 8.0. I would recommend replacing the each function with the foreach syntax.

foreach ($HTTP_GET_VARS as $k => $v) {
  $kv = [$k, $v];
}
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
pietgeluk
  • 34
  • 1