Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Backtrace with Graph Filters Search for * #604

Closed
reubenfarrelly opened this issue Apr 23, 2017 · 7 comments
Closed

Unexpected Backtrace with Graph Filters Search for * #604

reubenfarrelly opened this issue Apr 23, 2017 · 7 comments

Comments

@reubenfarrelly
Copy link

Looks like something isn't being escaped correctly...
If I go into the Graphs Tab, select a device, and then in Graph Filters so a Search of router (or anything else that starts with an asterisk) I get this output in the browser:

Validation error for variable rfilter, with value of "*router", and error:Compilation failed: nothing to repeat at offset 0. See backtrace below for more details.
(/graph_view.php: 240 html_validate_tree_vars)(/lib/html_tree.php: 533 validate_store_request_vars)(/lib/html_utility.php: 636 die_html_input_error)(/lib/html_validate.php: 60 cacti_debug_backtrace)

@cigamit
Copy link
Member

cigamit commented Apr 23, 2017

We don't allow that character. If you are looking for a wildcard, use the percent, though that would only be between words.

@cigamit
Copy link
Member

cigamit commented Apr 23, 2017

I'm not sure *router is a valid regex anyway.

@reubenfarrelly
Copy link
Author

I can't think of a valid regex either. In the past I have run Cacti installations where a filtered view was made visible to end customers - and I wouldn't expect them to know this. I think the best way to handle this would be to print a warning that the * character is not valid in this context and has been ignored, rather than an ugly looking backtrace which looks more like a bug.

@cigamit
Copy link
Member

cigamit commented Apr 23, 2017

Yea, true. Let me see about that...

@cigamit
Copy link
Member

cigamit commented Apr 23, 2017

Should be better now. We just clear the filter when the regex is invalid. Right now, there won't be an error message.

@cigamit cigamit closed this as completed Apr 23, 2017
@reubenfarrelly
Copy link
Author

Yep - looks better in the GUI now.

This is still logged in cacti.log though:

2017-04-23 22:56:18 - ERROR PHP WARNING: preg_match(): Compilation failed: nothing to repeat at offset 0 in file: /var/www/cacti.reub.net/htdocs/lib/html_utility.php on line: 742
2017-04-23 22:56:18 - CMDPHP PHP ERROR WARNING Backtrace: (/graph_view.php: 240 html_validate_tree_vars)(/lib/html_tree.php: 533 validate_store_request_vars)(/lib/html_utility.php: 595 validate_is_regex)(/lib/html_utility.php: 742 preg_match)(CactiErrorHandler)(/lib/functions.php: 4299 cacti_debug_backtrace)

cigamit added a commit that referenced this issue Apr 23, 2017
Don't show the regex errors when validating.
@cigamit
Copy link
Member

cigamit commented Apr 23, 2017

Should be much better now.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants