From b0a5f063abcc021644ecaf4d5cefbd2c7dd276ec Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 10 Jan 2026 19:14:26 +0100 Subject: Fix tags ILIKE (#8425) fix https://github.com/FreshRSS/FreshRSS/issues/8424 Regression from https://github.com/FreshRSS/FreshRSS/issues/8329 --- app/Models/DatabaseDAO.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/Models/DatabaseDAO.php') diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index 3d8389c87..e419e5892 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -504,11 +504,13 @@ SQL; /** * PHP emulation of the SQL ILIKE operation of the selected database. * Note that it depends on the database collation settings and Unicode extensions. + * @param bool $contains If true, checks whether $haystack contains $needle (`'Testing' ILIKE '%Test%'`), + * otherwise checks whether they are alike (`'Testing' ILIKE 'Test'`). */ - public static function strilike(string $haystack, string $needle): bool { + public static function strilike(string $haystack, string $needle, bool $contains = false): bool { // Implementation approximating MySQL/MariaDB `LIKE` with `utf8mb4_unicode_ci` collation. $haystack = self::removeAccentsLower($haystack); $needle = self::removeAccentsLower($needle); - return str_contains($haystack, $needle); + return $contains ? str_contains($haystack, $needle) : ($haystack === $needle); } } -- cgit v1.2.3