Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#4 | 3364284_preg_match_check_null.patch | 584 bytes | roxflame |
Comments
Comment #2
roxflame CreditAttribution: roxflame at Xequals commentedComment #3
roxflame CreditAttribution: roxflame at Xequals commentedPatch attached here cleared things up for me
Comment #4
roxflame CreditAttribution: roxflame at Xequals commentedUpdated 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 :)
Comment #6
adriancidThanks