Problem/Motivation

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\entity_field_condition\Plugin\Condition\NodeField->evaluate() (line 336 of modules/contrib/entity_field_condition/src/Plugin/Condition/NodeField.php).

Steps to reproduce

Create a context that uses a comparison to a field, use that context to render a block, visit a page where the block is placed (in our case in layout builder) and where the comparison field is empty

Proposed resolution

Check if parameter 2 is null before comparing

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

roxflame created an issue. See original summary.

roxflame’s picture

Issue summary: View changes
roxflame’s picture

Status: Active » Needs review
FileSize
772 bytes

Patch attached here cleared things up for me

roxflame’s picture

FileSize
584 bytes

Updated patch, had some incorrect formatting for patch paths, apologies, this is the first patch I've ever uploaded to drupal.org, doing some learning today :)

  • adriancid committed c0cc0ed9 on 8.x-1.x authored by roxflame
    Issue #3364284 by roxflame, adriancid: Deprecated function: preg_match...
adriancid’s picture

Status: Needs review » Fixed

Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.