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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | searchapi-3160757-1.patch | 1.58 KB | jordandukart |
| #2 | searchapi-3160757-1-testsonly.patch | 973 bytes | jordandukart |
Comments
Comment #2
jordandukart commentedIncluded 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.
Comment #3
jordandukart commentedComment #4
drunken monkeyThanks 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!
Comment #6
jordandukart commentedThanks so much @drunken monkey!