Welcome Guest, Not a member yet? Register   Sign In
Undefined variable: _SESSION
#2

PHP Code:
//$session = session();
//$user = $session->get('user'); 


Removes the session error message. Is the FilterInterface being called too early in the bootstrap process before sessions can even work?

PHP Code:
return redirect('login'); 

This line causes no errors but spark will load but no server will start.

This is how I fixed it to load with no errors:

PHP Code:
    public function before(RequestInterface $request) {
        if (! 
$request->isCLI()) {
            
$session session();
            
$user $session->get('user');

            if (empty(
$user['id'])) {
                return 
redirect('login');
            }
        }
    } 

Is this a bug or am I doing something wrong?

Thanks,
kyle
Reply


Messages In This Thread
Undefined variable: _SESSION - by NiteRaven - 11-20-2018, 08:56 AM
RE: Undefined variable: _SESSION - by NiteRaven - 11-20-2018, 04:12 PM
RE: Undefined variable: _SESSION - by ciadmin - 11-20-2018, 05:50 PM
RE: Undefined variable: _SESSION - by NiteRaven - 11-20-2018, 06:18 PM
RE: Undefined variable: _SESSION - by natanfelles - 11-20-2018, 08:34 PM
RE: Undefined variable: _SESSION - by kilishan - 11-20-2018, 08:36 PM
RE: Undefined variable: _SESSION - by kilishan - 11-22-2018, 09:49 PM
RE: Undefined variable: _SESSION - by NiteRaven - 11-24-2018, 10:42 AM
RE: Undefined variable: _SESSION - by NiteRaven - 12-02-2018, 03:14 PM
RE: Undefined variable: _SESSION - by kilishan - 12-03-2018, 02:03 PM
RE: Undefined variable: _SESSION - by NiteRaven - 12-03-2018, 02:26 PM
RE: Undefined variable: _SESSION - by kilishan - 12-03-2018, 02:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB