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

[5.6] Add an empty error bag for HTTP exceptions #23139

Merged
merged 1 commit into from
Feb 13, 2018
Merged

[5.6] Add an empty error bag for HTTP exceptions #23139

merged 1 commit into from
Feb 13, 2018

Conversation

webchopin
Copy link
Contributor

Before this PR, if you had a custom HTTP error page like 404.blade.php that happens to extend a master layout which uses the errors variable, you would have an exception stating that $errors is undefined instead of the custom HTTP error page.
Here are 2 typical scenarios of $errors usage in the master layout:

  • a navbar including a login form using $errors.
  • a login modal available for all pages as long as the user is not signed in.

There is an open issue related to it, including steps to reproduce: #23133

The goal of this PR is to add the $errors variable for all HTTP exceptions. This is a behavior which is similar to the web middleware : \Illuminate\View\Middleware\ShareErrorsFromSession. This middleware binds $errors to the session errors if the latter is defined and binds $errors to an empty view error bag otherwise because it is more convenient for the developer who doesn't have to run checks for the presence of errors.
In this HTTP exception fix, we do not have the session store set, so the errors variable is always set to an empty view error bag, again because it is more convenient for the developer.

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.

2 participants