aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Models/BooleanSearch.php2
-rw-r--r--app/Models/Search.php6
-rw-r--r--tests/app/Models/SearchTest.php4
3 files changed, 9 insertions, 3 deletions
diff --git a/app/Models/BooleanSearch.php b/app/Models/BooleanSearch.php
index 5cfcd9342..0a50464de 100644
--- a/app/Models/BooleanSearch.php
+++ b/app/Models/BooleanSearch.php
@@ -233,7 +233,7 @@ class FreshRSS_BooleanSearch {
private function parseOrSegments(string $input): void {
$input = trim($input);
- if ($input == '') {
+ if ($input === '') {
return;
}
$splits = preg_split('/\b(OR)\b/i', $input, -1, PREG_SPLIT_DELIM_CAPTURE) ?: [];
diff --git a/app/Models/Search.php b/app/Models/Search.php
index 52b000344..404b8bfac 100644
--- a/app/Models/Search.php
+++ b/app/Models/Search.php
@@ -73,6 +73,7 @@ class FreshRSS_Search {
public function __construct(string $input) {
$input = self::cleanSearch($input);
+ $input = self::unescape($input);
$this->raw_input = $input;
$input = $this->parseNotEntryIds($input);
@@ -662,4 +663,9 @@ class FreshRSS_Search {
}
return trim($input);
}
+
+ /** Remove escaping backslashes for parenthesis logic */
+ private static function unescape(string $input): string {
+ return str_replace(['\\(', '\\)'], ['(', ')'], $input);
+ }
}
diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php
index 0b832737a..afec683d5 100644
--- a/tests/app/Models/SearchTest.php
+++ b/tests/app/Models/SearchTest.php
@@ -330,8 +330,8 @@ class SearchTest extends PHPUnit\Framework\TestCase {
[
'intitle:"\\(test\\)"',
'(e.title LIKE ? )',
- ['%\\(test\\)%'],
- ]
+ ['%(test)%'],
+ ],
];
}
}