Problem/Motivation

When using the "IgnoreCharacters" processor plugin passing through a NULL value ends up being replaced by empty string. This can become an issue as this processor is also ran on ConditionGroups. In the Condition case a valid condition such as condition('field', NULL) or condition('field', NULL, '<>') gets removed entirely due to: https://git.drupalcode.org/project/search_api/-/blob/8.x-1.x/src/Processor/FieldsProcessorPluginBase.php#L429.

Proposed resolution

When a NULL value is encountered don't attempt to process it with the IgnoreCharacters plugin as the resultant value will return an empty string as opposed to the original NULL.

Comments

JordanDukart created an issue. See original summary.

jordandukart’s picture

StatusFileSize
new973 bytes
new1.58 KB

Included a tests-only patch that shows that this case will fail prior to the patch. NOTE: The IgnoreCharacters test has been moved over to use assertSame as opposed to assertEquals due to: https://github.com/sebastianbergmann/phpunit/issues/998.

jordandukart’s picture

Assigned: jordandukart » Unassigned
Status: Active » Needs review
drunken monkey’s picture

Status: Needs review » Fixed

Thanks for reporting this issue and already providing a patch. Looks great and makes a lot of sense.
Just some trailing whitespace to fix, but otherwise good, so: committed.
Thanks a lot again!

jordandukart’s picture

Thanks so much @drunken monkey!

Status: Fixed » Closed (fixed)

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