Skip to content
Snippets Groups Projects
Commit 2135a251 authored by catch's avatar catch
Browse files

Issue #2823963 by vaplas, Andrej Galuf, dawehner: Views StringFilter using...

Issue #2823963 by vaplas, Andrej Galuf, dawehner: Views StringFilter using 'Contains any word' or 'Contains all words' breaks query on strings containing only characters that will be trimmed
parent 01f8bd64
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -288,7 +288,7 @@ protected function opContainsWord($field) { ...@@ -288,7 +288,7 @@ protected function opContainsWord($field) {
} }
} }
if (!$where) { if ($where->count() === 0) {
return; return;
} }
......
...@@ -293,6 +293,42 @@ public function testFilterStringWord() { ...@@ -293,6 +293,42 @@ public function testFilterStringWord() {
], ],
]; ];
$this->assertIdenticalResultset($view, $resultset, $this->columnMap); $this->assertIdenticalResultset($view, $resultset, $this->columnMap);
$view->destroy();
$view = Views::getView('test_view');
$view->setDisplay();
// Change the filtering to a sting containing only illegal characters.
$view->displayHandlers->get('default')->overrideOption('filters', [
'description' => [
'id' => 'description',
'table' => 'views_test_data',
'field' => 'description',
'relationship' => 'none',
'operator' => 'allwords',
'value' => ':-)',
],
]);
$this->executeView($view);
$resultset = [
[
'name' => 'Ringo',
],
[
'name' => 'John',
],
[
'name' => 'George',
],
[
'name' => 'Paul',
],
[
'name' => 'Meredith',
],
];
$this->assertIdenticalResultset($view, $resultset);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment