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/DatabaseDAO.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/DatabaseDAO.php')
| -rw-r--r-- | app/Models/DatabaseDAO.php | 6 |
1 files changed, 4 insertions, 2 deletions
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); } } |
