Error
- mwversion: 1.44.0-wmf.25
- reqId: 245b1e09-b7c6-46f0-b406-74cd178ed3ba
- Find reqId in Logstash
normalized_message
[{reqId}] {exception_url} PHP Warning: preg_match(): Compilation failed: parentheses are too deeply nested at offset 1900[{reqId}] {exception_url} PHP Warning: preg_match(): Compilation failed: parentheses are too deeply nested at offset 1900| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| UstringLibrary: Silence preg_match warnings | mediawiki/extensions/Scribunto | master | +9 -3 |
Bad user input from some ustring pattern in some Lua module (or possibly the console). Possibly a user testing something.
Probably the relevant code should silence the error here - it already indicates to the user the match failed.
There's already a generous limit of 10_000 bytes for the pattern length. But it's not clear if it's possible to check the nesting depth without executing the regex. Else silencing the error might the better option.
$p = str_repeat('(', 200) . str_repeat(')', 200); $p2 = str_repeat('(', 300) . str_repeat(')', 300); preg_match("/^$p$/", "foo"); // No error preg_match("/^$p2$/", "foo"); // Compilation failed: parentheses are too deeply nested at offset
Change #1217455 had a related patch set uploaded (by Ammarpad; author: Ammarpad):
[mediawiki/extensions/Scribunto@master] UstringLibrary: Silence preg_match warnings