Skip to content

[Profiler] Notifications tab - Null pointer exception #49305

@jjfufu

Description

@jjfufu

Symfony version(s) affected

6.2

Description

A null pointer exception thrown on profiler "Notifications" tab when an event message with null notification is collected.

This bug only happen when symfony/notifier and symfony/messenger are installed simultaneous.

Error screenshot

image_720

web-profiler-bundle/Resources/views/Collector/notifier.html.twig (Line 117 and 131)

{% if message.getNotification is defined %}
  <div class="card-block">
      <div class="row">
          <div class="col">
              <span class="label">Content</span>
              <pre class="prewrap">{{ message.getNotification().getContent() ?? '(empty)' }}</pre>
              <span class="label">Importance</span>
              <pre class="prewrap">{{ message.getNotification().getImportance() }}</pre>
          </div>
      </div>
  </div>
{% endif %}

$notification property is defined but is null

How to reproduce

https://github.com/jjfufu/sf-web-profiler-notifications

Possible Solution

Possibly add and message.getNotification is not null to condition. And a specific display in the other case ?

Additional Context

This bug only happen when symfony/notifier and symfony/messenger are installed simultaneous.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions