You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Doubly nested parentheses in a selector throw "Recursion error detected" (e.g. li:not(:not(:nth-child(1)))) #120
A selector whose parentheses nest two levels deep fails to parse, throwing a QueryPath\Exception from the CSS scanner instead of matching:
QueryPath\Exception: Recursion error detected at iteration 31.
Thrown from QueryPath\CSS\Scanner::nextToken() (src/CSS/Scanner.php), which raises it when the input stream is exhausted while $this->recurse is set.
It is not specific to :has(): any functional pseudo-class nested inside another one with its own parenthesised argument triggers it. One level of nesting, or two levels where the inner pseudo-class takes no argument, is fine.
Selector
Result
li:not(:not(:nth-child(1)))
throws
li:not(:not(:eq(0)))
throws
li:not(:matches(:nth-child(1)))
throws
ul:has(li:not(:nth-child(1)))
throws
ul:not(:has(li:nth-child(3)))
throws
li:not(:not(:first-child))
ok
ul:not(:has(li))
ok
ul:not(:nth-child(1))
ok
Both selector engines are affected (find() and remove() throw the same exception), which points at the shared scanner/parser rather than either engine.
Minimal reproducible PHP+HTML snippet to replicate bug
Activity
Read nested pseudo-class arguments without skipping a token (#122)