Bug: Unfriendly Error Message when Using Invalid Regular Expression Search
You get an unhelpful error message if you specify an invalid regular expression search. The search should fail gracefully with an understandable error message.
Test case
%SEARCH{ "*WebS*" scope="topic" regex="on" nosearch="on" nosummary="on" nototal="on" format=" * $topic"}%
Temporarily remove the 'nop' above to enable the SEARCH.
- The invalid regex is
"*WebS*"
- The correct regex is
"^.*WebS.*$"
The invalid regex produces different error messages depending on the system used:
- TWiki.org with Debian Linux:
- User gets:
Software error: Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE WebS*/ at /path/to/twiki/lib/TWiki/Search.pm line 188 instead of the rendered page content
- Other system with RedHat Enterprise Linux, Perl v5.8 with SpeedyCGI:
- User gets "500 Internal Server Error" instead of the rendered page content
- Apache error log has:
Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE WebS*/ at /path/to/twiki/lib/TWiki/Search.pm line 188
In both cases, the user should see the rendered page content with an error message at the place of the SEARCH.
Environment
--
PeterThoeny - 30 Mar 2005
Impact and Available Solutions
Follow up
Fix record
Discussion