diff options
| author | 2026-01-10 19:14:26 +0100 | |
|---|---|---|
| committer | 2026-01-10 19:14:26 +0100 | |
| commit | b0a5f063abcc021644ecaf4d5cefbd2c7dd276ec (patch) | |
| tree | 25a102b6ce4648a4439cd7f0aa6474d9d075c1fd /app/Models/DatabaseDAOPGSQL.php | |
| parent | 6b46e70f5a7218943b5178939ed3335a96b22dfc (diff) | |
Fix tags ILIKE (#8425)
fix https://github.com/FreshRSS/FreshRSS/issues/8424
Regression from https://github.com/FreshRSS/FreshRSS/issues/8329
Diffstat (limited to 'app/Models/DatabaseDAOPGSQL.php')
| -rw-r--r-- | app/Models/DatabaseDAOPGSQL.php | 9 |
1 files changed, 5 insertions, 4 deletions
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); } } |
