aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-12-23 11:58:51 +0100
committerGravatar GitHub <noreply@github.com> 2025-12-23 11:58:51 +0100
commit6d57a9de47be4bb80a2121b6c4b8ebf278b93d70 (patch)
tree6cba47ef73451a678d9fd152fa385ac75c02460f /tests
parentcf3ca7076566909bd5b6eb519036f8d1b857f356 (diff)
Fix parsing of literal "or" in regex (#8338)
fix https://github.com/FreshRSS/FreshRSS/issues/7879
Diffstat (limited to 'tests')
-rw-r--r--tests/app/Models/SearchTest.php23
1 files changed, 23 insertions, 0 deletions
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',
+ ],
];
}