Closed (fixed)
Project:
Name Field
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Apr 2026 at 17:58 UTC
Updated:
9 May 2026 at 23:05 UTC
Jump to comment: Most recent
Fulltext.php
Lines 134-139
public function op_contains($fulltext_field) {
$value = mb_strtolower($this->value[0]);
$value = str_replace(' ', '%', $value);
$placeholder = $this->placeholder();
$this->query->addWhereExpression($this->options['group'], "$fulltext_field LIKE $placeholder", [$placeholder => '% ' . $value . '%']);
}
The value is parameter-bound, so no SQL injection. But the sibling op_word() escapes with $this->connection->escapeLike(...) before adding wildcards, and op_contains() doesn't — so literal %/_ typed by the user behave as SQL LIKE wildcards, broadening results beyond what the UI suggests.
Call escapeLike() first, then do the space-to-% conversion.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
sanketprajapati commentedHi @bluegeek9, I have created MR !84, Please review.
Before: https://prnt.sc/PFkCeaeEFjnt
After: https://prnt.sc/fgK5TCih3LJ8
Comment #7
bluegeek9 commented