Function Error
Description:
When a specific function in your code returns FALSE, it generates an event.
The “Function Error” Rule contains a list of monitored functions (i.e.
functions that when returning FALSE will trigger an event).
Information Collected:
The most important details are:
- Function Name - As displayed in the Issue’s General Details
- Function Arguments - The arguments of the function that triggered
the event are listed in the Function Data tab.
- Backtrace – identify what happened before the error happened that
may have caused a problem such as incorrect data or problematic input
data.
In most cases, these details alone should be enough
to indicate what triggered the event.
Applicable Diagnostic Actions:
Click on a link to see how to perform each action tools are listed in
order of relevance to helping solve the event:
- Run the Debugger
- Open code in editor
- Redefine database queries
- View information in the Logs
- Run the Profiler
Possible Causes and Solutions:
Generally, logic errors trigger Function Error
such as queries that you expect to return something and they do not and
not PHP errors.
If you have a function that you need to return FALSE as an acceptable
value, remove the function from the monitored functions list.
- Internal PHP functions – If you are using internal PHP functions,
the best reference for investigating the problem is use the PHP manual.
- You can also check your logs to see if they show PHP error information
logged the same time the function error occurred.
- User define functions – If it is a user defined function, running
the debugger will help find out if the function is running complicated
actions that are causing the function to fail. Using Breakpoints while
debugging, will further pinpoint the problematic area in the code.
- False Positives - Sometimes functions are supposed to return FALSE.
Not all functions that return FALSE are indicative of a problem in
your code or environment and they may be no indication of unacceptable
behavior. If this is the case, remove the function from the Rule’s
“Event Condition” list or set the status of issues triggered by this
function to ignored.
Note:
Removing a function from the rule, affects all instances
of the function. Before removing the function from the list, make sure
the function does not require monitoring wherever it is used.