Skip to content

[Notifier] Fix notifier profiler when transport name is null #49326

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

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Feb 10, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets n/a

When the transport name is null, the profiler is currently broken (JS error).

@@ -24,7 +24,7 @@ class NotificationEvents
public function add(MessageEvent $event): void
{
$this->events[] = $event;
$this->transports[$event->getMessage()->getTransport()] = true;
$this->transports[(string) $event->getMessage()->getTransport()] = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

null is anyway converted to an empty string by PHP. Let's be explicit here.

@@ -43,7 +43,7 @@ public function getEvents(string $name = null): array

$events = [];
foreach ($this->events as $event) {
if ($name === $event->getMessage()->getTransport()) {
if ($name === (string) $event->getMessage()->getTransport()) {
Copy link
Member

Choose a reason for hiding this comment

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

not sure about this one: do we support the empty string as transport name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

@nicolas-grekas
Copy link
Member

Thank you @fabpot.

@nicolas-grekas nicolas-grekas merged commit 8cf5f02 into symfony:5.4 Feb 13, 2023
This was referenced Feb 28, 2023
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.

3 participants