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

Fix exception controller #1870

Merged
merged 1 commit into from
May 20, 2018
Merged

Fix exception controller #1870

merged 1 commit into from
May 20, 2018

Conversation

gdbonino
Copy link
Contributor

No description provided.

@@ -42,27 +41,27 @@ protected function findTemplate(Request $request, $statusCode, $showException)
$format = $request->getRequestFormat();

$name = $showException ? 'exception' : 'error';
if ($showException && 'html' === $format) {
if ($showException && 'html' == $format) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this change?

@xabbuh
Copy link
Member

xabbuh commented Feb 22, 2018

I am not sure I understand why this change is necessary. Can we create a test case that proves that these changes are indeed needed?

@gdbonino
Copy link
Contributor Author

As the comment on TwigExceptionController.php explicitly says, this method should be synchronized on a regular basis against TwigBundle's version.

Since TwigBundle's method has been significatively modified FOSRest cannot longer find the local override template for custom error messages. If you disable FOSRest, the template works as expected.

The only thing I did on this PR is to replicate existing TwigBundle's code so FOSRest can find and display the template correctly.

If you need a test case, let me know and I'll try to build and share an example so you can see the problem in action.

@GuilhemN GuilhemN merged commit f6355e7 into FriendsOfSymfony:master May 20, 2018
@GuilhemN
Copy link
Member

Thank you @gdbonino.

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