aboutsummaryrefslogtreecommitdiff
path: root/app/Models/BooleanSearch.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-03-04 13:30:45 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-03-04 13:30:45 +0100
commitb3239256dc6d188cda970adab516b3fcf1b86129 (patch)
treed8e65dd9784834ba2e82ce7ee94b4718f8af19ea /app/Models/BooleanSearch.php
parent27b71ffa99f7dff013fb8d51d020ed628e0d2ce6 (diff)
parent0fe0ce894cbad09757d719dd4b400b9862c1a12a (diff)
Merge branch 'edge' into latest
Diffstat (limited to 'app/Models/BooleanSearch.php')
-rw-r--r--app/Models/BooleanSearch.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/Models/BooleanSearch.php b/app/Models/BooleanSearch.php
index b1c7bbd3b..279040a5a 100644
--- a/app/Models/BooleanSearch.php
+++ b/app/Models/BooleanSearch.php
@@ -118,8 +118,9 @@ class FreshRSS_BooleanSearch {
$nextOperator = 'AND';
while ($i < $length) {
$c = $input[$i];
+ $backslashed = $i >= 1 ? $input[$i - 1] === '\\' : false;
- if ($c === '(') {
+ if ($c === '(' && !$backslashed) {
$hasParenthesis = true;
$before = trim($before);
@@ -164,11 +165,12 @@ class FreshRSS_BooleanSearch {
$i++;
while ($i < $length) {
$c = $input[$i];
- if ($c === '(') {
+ $backslashed = $input[$i - 1] === '\\';
+ if ($c === '(' && !$backslashed) {
// One nested level deeper
$parentheses++;
$sub .= $c;
- } elseif ($c === ')') {
+ } elseif ($c === ')' && !$backslashed) {
$parentheses--;
if ($parentheses === 0) {
// Found the matching closing parenthesis