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/DatabaseDAOPGSQL.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/Models/DatabaseDAOPGSQL.php') diff --git a/app/Models/DatabaseDAOPGSQL.php b/app/Models/DatabaseDAOPGSQL.php index 116f8816e..1ead69192 100644 --- a/app/Models/DatabaseDAOPGSQL.php +++ b/app/Models/DatabaseDAOPGSQL.php @@ -101,17 +101,18 @@ SQL; } #[\Override] - public static function strilike(string $haystack, string $needle): bool { + public static function strilike(string $haystack, string $needle, bool $contains = false): bool { if (function_exists('mb_stripos')) { - return mb_stripos($haystack, $needle, 0, 'UTF-8') !== false; + return $contains ? (mb_stripos($haystack, $needle, 0, 'UTF-8') !== false) : + (mb_strtolower($haystack, 'UTF-8') === mb_strtolower($needle, 'UTF-8')); } if (function_exists('transliterator_transliterate')) { $haystack_ = transliterator_transliterate('Lower', $haystack); $needle_ = transliterator_transliterate('Lower', $needle); if ($haystack_ !== false && $needle_ !== false) { - return str_contains($haystack_, $needle_); + return $contains ? str_contains($haystack_, $needle_) : ($haystack_ === $needle_); } } - return stripos($haystack, $needle) !== false; + return $contains ? (stripos($haystack, $needle) !== false) : (strcasecmp($haystack, $needle) === 0); } } -- cgit v1.2.3