A function or method can be called dynamically using call_user_func_array
. If the call itself fails, FALSE
is returned. Also, call_user_func_array
returns the return values from the function or method that is called.
So when the called function or method returns FALSE
as well (for example, see SO example), that value would be recognised as a false positive.
How can one reliably check if the function or method call was executed succesfully by call_user_func_array
?
EDIT: People tend to point out the existence of is_callable
. But this is not about checking if a method exists before calling it, thus avoiding possible errors. Actually before doing call_user_func_array
the function call and it's arguments and argument types are already verified using Reflection
to avoid a Massive Assign attack.
The documentation mentions the FALSE
return value, but I fail to see how it can be used to check if the call was succesful.