Skip to content

[9.x] Start session in TestResponse to allow marshalling of error bag from JSON#42710

Merged
taylorotwell merged 2 commits into
laravel:9.xfrom
Krisell:fix/test-response-with-json-serialized-session
Jun 8, 2022
Merged

[9.x] Start session in TestResponse to allow marshalling of error bag from JSON#42710
taylorotwell merged 2 commits into
laravel:9.xfrom
Krisell:fix/test-response-with-json-serialized-session

Conversation

@Krisell
Copy link
Copy Markdown
Contributor

@Krisell Krisell commented Jun 8, 2022

When using 'session.serialization' => 'json' the ViewErrorBag content is saved as an array and rebuilt when the session data is loaded. In TestResponse the start() method on the session Store was never called, causing the issue discovered by @tanthammar in #42494

This PR adds a $this->session()->start() call in TestResponse unless the session is already started (i.e. once). The added test fails with Error: Call to a member function getBag() on array without the implementation change.

Related to #42090 and #40595

@Krisell Krisell changed the title Start session in TestResponse to allow marshalling of error bag from JSON [9.x] Start session in TestResponse to allow marshalling of error bag from JSON Jun 8, 2022
@Krisell Krisell changed the title [9.x] Start session in TestResponse to allow marshalling of error bag from JSON [9.x] Start session in TestResponse to allow marshalling of error bag from JSON Jun 8, 2022
@taylorotwell taylorotwell merged commit 1a2e484 into laravel:9.x Jun 8, 2022
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.

3 participants