-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Clone messages to show in profiler #26650
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
@@ -50,10 +60,9 @@ | |||
|
|||
{% block toolbar %} | |||
{% set color_code = 'normal' %} | |||
{% set message_count = 0 %} |
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.
@sroze Any reason why this was zero?
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.
Nop, very likely a mistake 🙊
@@ -31,7 +31,13 @@ | |||
<tbody> | |||
{% for message in collector.messages %} | |||
<tr> | |||
<td>{{ message.message.type }}</td> | |||
<td> | |||
{{ message.message.type }} |
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.
I don't believe we still need to display the type anymore if we use the dumper, as the FQCN is available as overlay :)
@@ -40,6 +46,10 @@ | |||
{% if message.exception.type is defined %} | |||
{{ message.exception.type }} | |||
{% endif %} | |||
|
|||
{% if message.result.object is defined %} |
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.
Same idea. If defined, I'd display this instead of the message.result.type
.
@@ -50,10 +60,9 @@ | |||
|
|||
{% block toolbar %} | |||
{% set color_code = 'normal' %} | |||
{% set message_count = 0 %} |
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.
Nop, very likely a mistake 🙊
@@ -63,6 +64,7 @@ public function handle($message, callable $next) | |||
if (is_object($result)) { | |||
$debugRepresentation['result'] = array( | |||
'type' => get_class($result), | |||
'object' => $this->cloneVar($result), | |||
); | |||
} else { |
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.
should be cloned as well in case it is an array, as it might contain objects inside the array
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.
btw, the template does not seem to use the value in this case when rendering the info, so why storing it ?
IMO, messages should not be stored directly in |
Thank you for the review |
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.
Looks good to me 👍 (after squashing the commits, obsly)
5700de0
to
52f4da9
Compare
Done |
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.
Failure in un-related 👍
@@ -77,7 +84,7 @@ public function handle($message, callable $next) | |||
); | |||
} | |||
|
|||
$this->data[] = $debugRepresentation; | |||
$this->data['messages'][] = $debugRepresentation; |
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.
collect
must ensure that $this->data['messages']
is always an array, even when no message was handled there, to make getMessages
work without notice after collect
has been called.
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.
Thank you
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.
@Nyholm your changes did not fix this btw 😉
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.
Doesn't it?
Cant I trust that $this->data
always to be null or an array?
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.
Actually, you're right, it won't "throw" a PHP notice.
@@ -77,7 +84,7 @@ public function handle($message, callable $next) | |||
); | |||
} | |||
|
|||
$this->data[] = $debugRepresentation; | |||
$this->data['messages'][] = $debugRepresentation; |
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.
@Nyholm your changes did not fix this btw 😉
@@ -77,7 +84,7 @@ public function handle($message, callable $next) | |||
); | |||
} | |||
|
|||
$this->data[] = $debugRepresentation; | |||
$this->data['messages'][] = $debugRepresentation; |
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.
Actually, you're right, it won't "throw" a PHP notice.
@@ -88,6 +95,10 @@ public function handle($message, callable $next) | |||
|
|||
public function getMessages(): array | |||
{ | |||
return $this->data; | |||
if (!isset($this->data['messages'])) { |
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.
return $this->data['messages'] ?? array();
(note the array()
, this will make fabbot happy)
Thank you |
ff354df
to
359a658
Compare
I've rebased this PR now. Im ready for a final review. |
Thank you @Nyholm. |
This PR was squashed before being merged into the 4.1-dev branch (closes #26650). Discussion ---------- [Messenger] Clone messages to show in profiler | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | na | License | MIT | Doc PR | na We should make the profiler page more pretty by using the cloner.  Commits ------- 4d1be87 [Messenger] Clone messages to show in profiler
We should make the profiler page more pretty by using the cloner.