Eric
Eric

Reputation: 827

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?

Upvotes: 4

Views: 2969

Answers (2)

hakre
hakre

Reputation: 198219

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.

Upvotes: 8

TJHeuvel
TJHeuvel

Reputation: 12618

What if instead of extracting the config to your local scope you just assign it to an array, and use those values? The error seems to be there, not with sessions.

Upvotes: 0

Related Questions