You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create at least one Entry with a value for a given field (e.g., handle: 'foo').
Create at least one separate Entry with no value for the same field from step 1.
Create a query scope using the where method; with the field handle from steps 1 and 2 in the first argument; and using the regexp operator in a where method (e.g., $query->where('foo', 'regexp', '^bar$');
Apply that query scope to an Entries field, configuring that field to allow it to select from the collection of the entries from steps 1 and 2.
Edit an entry/tag/etc. (or create a new one) that uses the field from step 4.
While editing the entry/tag/etc. from step 5, check the debug bar messages for the field from step 4 and presumably see LOG.warning: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in ...statamic\cms\src\Query\Builder.php on line 702
Bug description
When I use the regex operator in a where clause...
... I get the following log warning:
LOG.warning: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in ...statamic\cms\src\Query\Builder.php on line 702
The error is likely caused by some entries not having the 'foo' field/column, resulting in a null value being passed to the preg_match function.
It seems like the work from this v3.3.12 commit could be extended to the filterTestLikeRegex() function in cms/src/Query
/Builder.php: 1cde722.
Current:
Proposed:
How to reproduce
$query->where('foo', 'regexp', '^bar$');
LOG.warning: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in ...statamic\cms\src\Query\Builder.php on line 702
Logs
No response
Environment
Installation
Starter Kit using via CLI
Additional details
No response
The text was updated successfully, but these errors were encountered: