-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
When numeric regex validation fails, no backtrace is logged #5089
Comments
To add, there is no red fields. |
This is not a php 8 issue. The issue is that the regex validation failed to pass on the input. |
Was there a stack trace in the logs to go with that error? |
Nope, I tried to set devel logging, and enable anything that would increase verbosity, but that was it. I have just set 8.0 again to help debug if needed, host.php I selected for debug as well, but its just that line. |
Do you have any plugins installed? If so, please name them. |
Okay, I this is interesting. Basically you have an invalid REGEX in one of your Data Input Methods. If you run the following Query: SELECT dtd.data_input_id, dl.host_id, dif.id, dif.input_output, dif.data_name,
dif.regexp_match, dif.allow_nulls, dif.type_code
FROM data_template_data AS dtd
LEFT JOIN data_input_fields AS dif
ON dif.data_input_id = dtd.data_input_id
LEFT JOIN data_local AS dl
ON dtd.local_data_id = dl.id
WHERE dif.input_output='in' and regexp_match != ''; You will find a Data Input Method that specifies a Regex, and the value of the Regex is 0, which is not a valid regular expression. Here is a Screen Shot of that inside of Cacti. If you run that Query, it'll give you a Data Input ID, then Edit that ID and clear the Regex Match. I'm going to see about handing this error during save though, but as a separate issue. |
Okay, after more testing '0' is a valid Regex value, but it also means that there is something wrong with you Data Input Method such that no data is being provided. Let me know what comes back from the query. This is likely happening at Graph Creation Time. |
@chrcoluk, any Feedback? |
You will notice that the regex is 0, which means the exact value allowed is only 0, which is bad. So, the Data Input Method needs to be altered and the Regex cleared from the input field. So, this is really not a bug. It's a developer issue who is writing the Data Input Method. |
Hi I wasnt here for two days, I can run this query and give you the result, if you are still interested. I wasnt actually trying to create a graph though, I was just going into the devices page and back out of it, without changing/saving anything. Also ideally the logs should point this to me, as the warning/error was very vague? I will get back to you on the query. Do you have any reason as well as to why php 7.x doesnt detect this and 8.0 does? |
I get an empty result, not even a 0, just nothing. This is probably correct as I dont think I use regex on any of them.
|
If I browse the data input methods, the majority will make the box popup and log an entry in the log, again no trace, also never anything highted red. PHP 7.4 no popups, no log entries. Is there a way to disable this validation? |
What plugins do you have installed? If you do, mention their versions. |
Yes, there is a way to turn it off, but before we do, let's find out where it's happening. |
Ok list of plugins as presented in the GUI Monitor Active 2.5 I have no care for the middle two so dont mind dropping tham as is. |
Okay, it's one of them. Can't you tgz and upload Fix64 and Ipsubnet? |
To stop the message go to Settings > General and disable Log Input Validation Issues |
It's really a developer mode to catch bad behavior, which it did perfectly, well maybe a little less than perfectly. |
When numeric regex validation fails, not backtrace message is logged in the Cacti log
I've made an update to lib/functions.php that will be a part of Cacti 1.2.23 that will give you a better clue as to where the bug is when in Log Validation Issues mode. |
Ok I will do the upload, and remove those 2, also when I toggled the option, it stopped the log but didnt remove the popup, could you please also make the option remove the popup? |
Describe the bug
Popup box which says this when going in and out of device settings, also happens on some other screens.
Log says the following.
4/Dec/2022 20:53:02 - CMDPHP Form Validation Failed: Variable 'id' with Value '66' Failed REGEX '0'
To Reproduce
Steps to reproduce the behavior:
Do as above, whilst using PHP 8.0 or newer.
Expected behavior
No errors.
Desktop (please complete the following information)
Windows, Firefox (latest stable)
Additional context
Switching back to PHP 7.4, its error free, note PHP 7.4 is EOL.
The text was updated successfully, but these errors were encountered: