A regular expression takes quadratic or higher polynomial time on some inputs, confirmed with an input that shows it
What it finds
preg_match('/\s+$/', $line): each start position runs the repetition to the end of the input before the anchor fails, so the time grows with the square of the input length. Reported as for regex-exponential-backtracking, when the confirmed growth is a polynomial of degree two or more.
From the rule's source, regex_backtracking.rs.
Turn it on, off or suppress it
The rule runs from the all tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/php:regex-polynomial-backtracking" = "note"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/php:regex-polynomial-backtracking] reason="..."tx0 explain tx0/php:regex-polynomial-backtracking shows the same in the terminal. Found a false positive? Report it.