-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fixed the rendering of exceptions inside the profiler #22491
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
Conversation
.hidden { display: none; } | ||
.nowrap { white-space: nowrap; } | ||
.newline { display: block; } | ||
.break-long-words { -ms-word-break: break-all; word-break: break-all; word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check word-break
value. it looks strange
https://developer.mozilla.org/en-US/docs/Web/CSS/word-break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that it looks weird ... but apparently that's the only way to make this work for every browser, as shown here: https://css-tricks.com/almanac/properties/w/word-break/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I see. good to know, thanks
Thank you @javiereguiluz. |
…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:  --- This PR goes a bit further and tweaks the exception styles slightly to better integrate them. Same page as before:  It should also work reasonably well when the exception message is very long:  Commits ------- 73d81de Fixed the rendering of exceptions inside the profiler
@javiereguiluz: Why does the new CSS file have |
Oh, I see: include() function is for including templates. |
.sf-reset .traces li.selected { | ||
background: rgba(255, 255, 153, 0.5); | ||
} | ||
{{ include('@Twig/exception.css.twig') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you did not use {{ source('@Twig/exception.css') }}
?
I think that the CSS file is not supposed to be a template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC you can't include a non Twig template in Twig. Remember this is not php include but uses the Twig loader to find and load files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the source() function documentation:
The source function returns the content of a template without rendering it
The function uses the same template loaders as the ones used to include templates. So, if you are using the filesystem loader, the templates are looked for in the paths defined by it.
Isn't this what we need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use either include() or source(). And the file can be .css or .css.twig. Everything will work 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, both functions will put the CSS code in the HTML in the end. My point is that include()
is trying to parse the CSS file as Twig which is not needed.
It is similar to having an index.php file that contains HTML page and wants to in-line some CSS by calling require 'theme.css.php'
in the header (where theme.css.php
is a plain CSS file and does not contain any PHP) instead of just echo file_get_contents('theme.css')
or readfile('theme.css')
.
But after all it's only detail so lets not expend any more time on it. Thanks for fixing the exception page in the profiler.
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:
This PR goes a bit further and tweaks the exception styles slightly to better integrate them. Same page as before:
It should also work reasonably well when the exception message is very long: