Skip to content

[WebProfilerBundle] Fix exception rendering #22448

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

Closed
wants to merge 1 commit into from

Conversation

e-moe
Copy link
Contributor

@e-moe e-moe commented Apr 15, 2017

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #22442
License MIT
Doc PR none

@@ -105,7 +105,7 @@ public function cssAction($token)

protected function getTemplate()
{
return '@Twig/Exception/'.($this->debug ? 'exception' : 'error').'.html.twig';
return '@Twig/Exception/'.($this->debug ? 'exception_full' : 'error').'.html.twig';
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this is the correct fix because it includes the hole HTML page!

Copy link
Contributor

@sustmi sustmi Apr 16, 2017

Choose a reason for hiding this comment

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

Note that error.html.twig (that is used when debug is false) contains full HTML page too.

@stof
Copy link
Member

stof commented Apr 19, 2017

This looks wrong to me. The exception panel is using inline rendering of a subcontroller, so it should not return something containing the <html> and <body> tags.
this actually means that the code is currently broken when using the WebProfilerBundle in non-debug mode (which probably nobody is doing, and so nobody noticed it) or when the TwigBundle template does not exist (which may happen when using Silex).

The right fix for the symfony full-stack case would be to fix the cssAction to return the right CSS instead (the new one)

@e-moe
Copy link
Contributor Author

e-moe commented Apr 19, 2017

thanks for your review. I will try to update this PR in order to apply your suggestions

@e-moe
Copy link
Contributor Author

e-moe commented Apr 20, 2017

updated. css taken from src/Symfony/Bundle/TwigBundle/Resources/views/layout.html.twig with small modifications (e.g. removed .container styling)

@javiereguiluz
Copy link
Member

@e-moe thanks for contributing this bug fix. However, the current solution has some problems (see #22491) so I've opened a new PR to fix this. That's why I'm closing this. Thanks!

fabpot added a commit that referenced this pull request Apr 22, 2017
…iereguiluz)

This PR was merged into the 3.3-dev branch.

Discussion
----------

Fixed the rendering of exceptions inside the profiler

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22442
| License       | MIT
| Doc PR        | -

In #22448 we tried to reuse the same CSS styles as the new exception pages. But that's not enough because it doesn't look good:

![before](https://cloud.githubusercontent.com/assets/73419/25250100/a287b4bc-2614-11e7-88e7-e0ef89eac1ff.png)

---

This PR goes a bit further and tweaks the exception styles slightly to better integrate them. Same page as before:

![after_1](https://cloud.githubusercontent.com/assets/73419/25250131/b8d16cf4-2614-11e7-93b4-187248849103.png)

It should also work reasonably well when the exception message is very long:

![after_2](https://cloud.githubusercontent.com/assets/73419/25250144/c25eab38-2614-11e7-99e2-843548d12810.png)

Commits
-------

73d81de Fixed the rendering of exceptions inside the profiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants