Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation errors are always empty in Laravel 9.x-dev #40773

Closed
robinheidrich opened this issue Feb 3, 2022 · 3 comments · Fixed by #42090
Closed

Validation errors are always empty in Laravel 9.x-dev #40773

robinheidrich opened this issue Feb 3, 2022 · 3 comments · Fixed by #42090
Labels

Comments

@robinheidrich
Copy link

  • Laravel Version: 9.x-dev
  • PHP Version: 8.1.2
  • Database Driver & Version: MariaDB 10.6.5

Description:

Since I upgraded to Laravel 9, validation errors are no longer displayed.

The output of dd($errors) always returns an empty array, even if there definitely should be an error.

Illuminate\Support\ViewErrorBag {[#289 ▼]()
  #bags: []
}

I tested if this is definitely an error in Laravel 9 and when downgrading back to Laravel 8 the errors were displayed again.

No idea what the reason is.

Steps To Reproduce:

  • Use a validation in the controller
  • Output the content of $errors in the view

In Laravel 8 the error is displayed, in Laravel 9 it is not.

@liviusirbulescu
Copy link

This is due to the new Session Serialization Strategy in 9.x (introduced in beta 4). Errors are empty only when serialization is set to 'json' in config/session.php (current default), either comment or update 'serialization' => 'php' as a temporary workaround.

@chuckrincon
Copy link

For more information about this change: [9.x] JSON Session Option

@driesvints
Copy link
Member

I've sent in a PR to revert this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants