Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater laravel [closed]

Tags:

php

laravel

Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in laravel

I don't have access to php.ini file at the server so i can't turn magic_quotes off, i have already tried .htaccess method it didn't work.

like image 309
Anand mohan sinha Avatar asked Oct 05 '22 21:10

Anand mohan sinha


1 Answers

You should ask your hosting provider to turn off magic quotes.

If you can't do that, you can use this code to remove magic quotes your self:

// Remove Magic Quotes

if (get_magic_quotes_gpc()) {
    $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
    while (list($key, $val) = each($process)) {
        foreach ($val as $k => $v) {
            unset($process[$key][$k]);
            if (is_array($v)) {
                $process[$key][stripslashes($k)] = $v;
                $process[] = &$process[$key][stripslashes($k)];
            } else {
                $process[$key][stripslashes($k)] = stripslashes($v);
            }
        }
    }
    unset($process);
}    

Just put this code somewhere at bootstrap level, or you should put this as first code in your scripts.

I had similar situation where I had PHP 5.3 and magic quotes turned on. Hope this helps!

like image 129
Matija Avatar answered Oct 09 '22 16:10

Matija