Skip to content

[9.x] Fix ViewErrorBag for JSON session serialization#42090

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
Krisell:fix/view-error-json-serialization
Apr 22, 2022
Merged

[9.x] Fix ViewErrorBag for JSON session serialization#42090
taylorotwell merged 3 commits into
laravel:9.xfrom
Krisell:fix/view-error-json-serialization

Conversation

@Krisell

@Krisell Krisell commented Apr 22, 2022

Copy link
Copy Markdown
Contributor

The json session serialization format added in Laravel 9 (#40595) doesn't work for flashed validation errors since those are serialized from the ViewErrorBag instance. ViewErrorBag does not implement JsonSerializable and more importantly need to be recreated when reading the session data back.

This PR intends to resolve this by storing the necessary information as an array, and rehydrating the instance after reading the session data back. This tries to implement the suggestion by Taylor here: laravel/laravel#5796 (comment)

Note that this changes nothing unless $serialization === 'json'.

Fixes #40773
Related to #41850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants