From 6d57a9de47be4bb80a2121b6c4b8ebf278b93d70 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 23 Dec 2025 11:58:51 +0100 Subject: Fix parsing of literal "or" in regex (#8338) fix https://github.com/FreshRSS/FreshRSS/issues/7879 --- tests/app/Models/SearchTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php index fad5d4768..213fdde45 100644 --- a/tests/app/Models/SearchTest.php +++ b/tests/app/Models/SearchTest.php @@ -790,6 +790,21 @@ final class SearchTest extends \PHPUnit\Framework\TestCase { '((e.title LIKE ? OR e.content LIKE ?) )', ['%https://example.net/test/%', '%https://example.net/test/%'] ], + [ // Regex with literal 'or' + 'intitle:/^A or B/i', + '(e.title ~* ? )', + ['^A or B'] + ], + [ // Regex with literal 'OR' + 'intitle:/^A B OR C D/i OR intitle:/^A B OR C D/i', + '(e.title ~* ? ) OR (e.title ~* ? )', + ['^A B OR C D', '^A B OR C D'] + ], + [ // Quote with literal 'OR' + 'intitle:"A B OR C D" OR intitle:"E or F"', + '(e.title LIKE ? ) OR (e.title LIKE ? )', + ['%A B OR C D%', '%E or F%'] + ], ]; } @@ -997,6 +1012,14 @@ final class SearchTest extends \PHPUnit\Framework\TestCase { '-intitle:a -inurl:b', '-intitle:a -inurl:b', ], + [ + 'intitle:/^A or B/i', + 'intitle:/^A or B/i', + ], + [ + 'intitle:/^A B OR C D/i', + 'intitle:/^A B OR C D/i', + ], ]; } -- cgit v1.2.3