Bug #3689
closed
Filter logs Input Validation Failure
Added by Mark Wharton over 10 years ago.
Updated over 10 years ago.
Description
In
diag_logs_filter.php
entering a source or destination in the format 1.1.1.0/24 causes the below error to be repeated in the page output.
Warning: preg_match(): Unknown modifier '2' in /etc/inc/filter_log.inc on line 104 Warning: preg_match(): Unknown modifier '2' in /etc/inc/filter_log.inc on line 104 Warning: preg_match(): Unknown modifier '2' in /etc/inc/filter_log.inc on line 104 Warning: preg_match(): Unknown modifier '2' in /etc/inc/filter_log.inc on line 104 Warning: preg_match(): Unknown modifier '2' in /etc/inc/filter_log.inc on line 104
I Appreciate it's a expecting a regular expression, but I wouldn't expect an error rendered for an invalid regex.
I submitted pull request https://github.com/pfsense/pfsense/pull/1222
This will be nice to this type of input, escaping the "/" to make the example become 1.1.1.0\/24 which is a valid regex.
The user can type all sorts of other invalid regex and get qa screen full of PHP warning messages from preg_match() calls. So I suppressed the warning text, that results in an empty table when the user enters an invalid regex.
Note for interest: When you enter stuff like 10.49.2.5 the dots are actually regex special characters that mean "match any single character". So this matches 10.49.215 for example (thus an address like 10.49.215.1 matches and appears in the output). In this GUI page, users normally mean the dots to be "real" and should enter 10\.49\.2\.5 to actually match the string "10.49.2.5". That is the designed and intended behavior, so no attempt to change or "help" with that. But I just noted it here for the benefit of random readers.
- Status changed from New to Feedback
- Target version set to 2.2
- % Done changed from 0 to 100
- Status changed from Feedback to Resolved
Also available in: Atom
PDF