Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session error using Laravel PHP

I get this error when enabling sessions, using the filesystem, in Laravel PHP.

Only variables should be passed by reference in SYS_PATH/session.php on line 230.

Stack Trace:
0 /Applications/XAMPP/xamppfiles/htdocs/laravel/system/session.php(230): System\{closure}(2048, 'Only variables ...', '/Applications/X...', 230, Array)

1 /Applications/XAMPP/xamppfiles/htdocs/laravel/system/session.php(190): System\Session::write_cookie()

2 /Applications/XAMPP/xamppfiles/htdocs/laravel/system/laravel.php(187): System\Session::close()

3 /Applications/XAMPP/xamppfiles/htdocs/laravel/public/index.php(44): require('/Applications/X...')

4 {main}

Snapshot:
225:     */
226:    private static function write_cookie()
227:    {
228:        if ( ! headers_sent())
229:        {
230:            extract(Config::get('session'));
231: 
232:            $minutes = ($expire_on_close) ? 0 : $lifetime;
233: 
234:            Cookie::put('laravel_session', static::$session['id'], $minutes, $path, $domain, $https, $http_only);
235:        }

Has anybody run into this issue? Even if you don't use Laravel, any insight?

like image 378
Eric Avatar asked Feb 23 '23 04:02

Eric


1 Answers

That you're seeing the error message is a flaw in the Laravel PHP framework.

The session class makes use of the extract function that is expecting a variable, but it get's a function return.

I have reported this behavior to the project and you can discuss the options with them as well. You find a suggestion how to fix it attached, let me know if that works for you.

like image 116
hakre Avatar answered Feb 26 '23 20:02

hakre