Warning: Attempt to read property "html" on null

Created on 7 December 2023, about 1 year ago
Updated 4 January 2024, 12 months ago

Problem/Motivation

While using the UrlEmbedFilter in the url_embed module, a warning is triggered, indicating an attempt to read the property "html" on a null object. This warning is found in the process method of the UrlEmbedFilter plugin.

Steps to reproduce

  1. Add the url_embed filter to the text format.
  2. Create content and check the View node page.

The result is:
Warning: Attempt to read property "html" on null in Drupal\url_embed\Plugin\Filter\UrlEmbedFilter->process() (line 78 of modules/contrib/url_embed/src/Plugin/Filter/UrlEmbedFilter.php).

Proposed resolution

Since the warning mentions an attempt to read the property "html" on a null object in the UrlEmbedFilter plugin, we need to check if the object is properly initialized before accessing its properties.

πŸ› Bug report
Status

Postponed: needs info

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine v.dovhaliuk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024