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

Agent57's avatar

Laravel 8 - Problems with validation errors on large form [SOLVED]

Hi folks,

I have a Blade form with 35 input fields. Although, this can be more if the user chooses to extend the form by inserting additional sections.

When the form is submitted and validation errors are identified, there seems to be a limit on how many old_input fields can be passed on in the session object within the returned redirect. So, if I have the basic 35 old_input data fields saved in the session, then the validation errors and old_input are passed back to the blade file and can be displayed correctly. However, if I go over that by adding just 1 extra input field, then the validation errors and old_inputs are not passed back. The validation errors and old_input are completely missing from the session data after the redirect.

I get no errors in the laravel.log, or the webserver logs. I am using the file session driver but have also tried cookie and database. Neither did any better. I've also had exactly the same result running in both my dev environment using a Nginx docker container, and on the live environment running Apache. I can't seem to find any way to affect the limit.

By setting a breakpoint in the edit() method of my controller, I can see that the session data is passed back correctly following the redirect with just the 35 inputs, but errors and old_input are missing with any more than that. Setting a breakpoint in the update() method, I can also see that prior to the redirect being returned the session always appears to be correct and does hold all the errors and old_input items even with 36+ input fields.

Any help with understanding what is causing this would be very much appreciated.

I'm not trying anything fancy here. My controller's update() and edit() methods are very basic...

public function update(Request $request, SomeModel $someModel)
{
  $validator = Validator::make($request->all(), [/*rules*/]);
  if($validator->fails()) {
    $redirect = redirect(route('someModel.edit', $someModel->id))
      ->withErrors($validator)
      ->withInput();
    
    // Breakpoint here shows validation works fine with 36+ fields
    return $redirect
  }
  
  // Validation passed
}

public function edit(SomeModel $someModel)
{
  // Breakpoint here shows that the redirected session will only work with up to 35 fields
  return view('someModel.edit')->with($someModel);
}
0 likes
6 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

What is your session driver set to? Can you try SESSION_DRIVER=file and see if that fixes it?

Agent57's avatar

Hi Sinnbeck, Thanks for a quick reply.

As I noted above, the session driver is already set to file. Is there any other configuration that might affect the behaviour of this?

Sinnbeck's avatar

@Agent57 Oh sorry missed that. I have only had similar issues when storing it in the cookie driver.

Agent57's avatar

No problem Sinnbeck,

It was a fair point to raise. Especially in light of the fact that after reading your reply I thought I'd just do a full text search in the project files for SESSION_DRIVER as a sanity check.

I had updated the entry in config/session.php, but it turns out I'm rather low on the sanity scale, and now feeling a little embarrassed that I found an entry in my .env file that was set to cookie : (

Your diagnosis was correct, so thank you!

Sinnbeck's avatar

@Agent57 awesome. Happy to help. Please mark best answer to set the thread as solved

Please or to participate in this conversation.