diff --git a/src/Medoo.php b/src/Medoo.php index 6ebff1f3..c3ee6813 100644 --- a/src/Medoo.php +++ b/src/Medoo.php @@ -943,8 +943,8 @@ protected function dataImplode(array $data, array &$map, string $conjunctor): st $item = '%' . $item . '%'; } - $likeClauses[] = $column . ($operator === '!~' ? ' NOT' : '') . " LIKE {$mapKey}L{$index}"; - $map["{$mapKey}L{$index}"] = [$item, PDO::PARAM_STR]; + $likeClauses[] = $column . ($operator === '!~' ? ' NOT' : '') . " LIKE {$mapKey}L{$index}$"; + $map["{$mapKey}L{$index}$"] = [$item, PDO::PARAM_STR]; } $stack[] = '(' . implode($connector, $likeClauses) . ')'; diff --git a/tests/WhereTest.php b/tests/WhereTest.php index 051d0465..32610bc5 100644 --- a/tests/WhereTest.php +++ b/tests/WhereTest.php @@ -642,6 +642,44 @@ public function testWildcardLikeWhere($type) ); } + /** + * @covers ::select() + * @covers ::dataImplode() + * @covers ::whereClause() + * @dataProvider typesProvider + */ + public function testMultipleLikeWhere($type) + { + $this->setType($type); + + $words = [ + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "ten", + "eleven", + "twelve" + ]; + + $this->database->select("account", ["title"], ["title[~]" => $words]); + + $this->assertQuery( + <<database->queryString + ); + } + /** * @covers ::select() * @covers ::dataImplode()