Permalink
Browse files

Fixed probable backtracking issue in some cases.

  • Loading branch information...
cubiclesoft committed Aug 12, 2018
1 parent 96e1cdd commit 9def49fa3f7d4a4a9eab257e64151af958b97e43
Showing with 9 additions and 2 deletions.
  1. +9 −2 support/tag_filter.php
View
@@ -1343,8 +1343,15 @@ public function Find($query, $id = 0, $cachequery = true, $firstmatch = false)
$y = count($rules[$x]);
for ($x2 = 0; $x2 < $y; $x2++)
{
if ($this->nodes[$id2]["type"] === "content") $backtrack = true;
else if (isset($rules[$x][$x2]["namespace"]) && $rules[$x][$x2]["namespace"] !== false && $rules[$x][$x2]["namespace"] !== "*" && (($rules[$x][$x2]["namespace"] === "" && strpos($this->nodes[$id2]["tag"], ":") !== false) || ($rules[$x][$x2]["namespace"] !== "" && strcasecmp(substr($this->nodes[$id2]["tag"], 0, strlen($rules[$x][$x2]["namespace"]) + 1), $rules[$x][$x2]["namespace"] . ":") !== 0))) $backtrack = true;
if ($this->nodes[$id2]["type"] === "content" || $this->nodes[$id2]["type"] === "comment")
{
// Always backtrack at non-element nodes since the rules are element based.
$backtrack = !(isset($rules[$x][$x2]["not"]) && $rules[$x][$x2]["not"]);
}
else if (isset($rules[$x][$x2]["namespace"]) && $rules[$x][$x2]["namespace"] !== false && $rules[$x][$x2]["namespace"] !== "*" && (($rules[$x][$x2]["namespace"] === "" && strpos($this->nodes[$id2]["tag"], ":") !== false) || ($rules[$x][$x2]["namespace"] !== "" && strcasecmp(substr($this->nodes[$id2]["tag"], 0, strlen($rules[$x][$x2]["namespace"]) + 1), $rules[$x][$x2]["namespace"] . ":") !== 0)))
{
$backtrack = true;
}
else
{
switch ($rules[$x][$x2]["type"])

0 comments on commit 9def49f

Please sign in to comment.