Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bnazarov's avatar

Session Flash on L5.4

Guys and girls, any assistance will be appreciated. I went over at least 50 "solutions" and none worked. I even made it super simple and still not working and I'm getting NULL.

Route::get('/flash', function() {
    session()->flash('itsme', 'working');

    return redirect('/flashshow');
});
Route::get('/flashshow', function() {
    var_dump(session('itsme'));
});

PS1: May worth to mention that sessions do work. If I use put instead of flash it will work.

0 likes
4 replies
mindz's avatar

I pasted above to first nearby project with L5.4 and it worked.

string(7) "working"

did you clean cache or somethink? What is your SESSION_DRIVER?

1 like
bnazarov's avatar

@mindz SESSION_DRIVER=file I cleared the cache and still get this error.

I believe the Kernel file was changed but it looks ok to me.

    protected $middleware = [\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,];


protected $middlewareGroups = ['web' => [\App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \App\Http\Middleware\CheckRegistrationCompleted::class,], 'api' => ['throttle:60,1', 'bindings',],];
bnazarov's avatar
bnazarov
OP
Best Answer
Level 17

I decided to check with the default Kernel and it's working fine - obviously it's the Kernel file. Will have to check why it was modified.

mindz's avatar

I cant recall any situation of automatic comment line of files ;) Regards

Please or to participate in this conversation.