You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that I'm passing an invalid set of attributes as the second parameter, given that the element bar is an array while only scalar attributes are supported.
Expected Behavior
I expect to get an error message something like this:
WARNING: newrelic_record_custom_event: expects parameter 2 to be an associative array where each element is a scalar; array given at key `'bar'.
I am very bad at phrasing error messages and you can phrase the message however you please, but the bare minimum amount of information that I demand is as above.
In particular:
that the issue is with the second argument passed to the function
that the elements of that array are what is expected to be scalar, while one of them was an array
what element was an array.
Observed Behavior
The error message actually thrown is this:
Warning: newrelic_record_custom_event(): newrelic_record_custom_event: expects parameter to be scalar, array given
which sucks because it lacks all the information mentioned above.
This message is extremely confusing because it looks very similar to PHP's native error message
function_name expects parameter N to be scalar, array given
so I'm induced to immediately inspect the two arguments that I passed to the function (and I'm already irritated that it's not telling me which one is the problematic one), and since the first one (the event name) is the one that is actually expected to be scalar, I'm thinking that I accidentally passed an array for the event name. So this is misleading me.
It took me a long while to realize that this was not PHP's native error message complaining about one of the two arguments passed to the function not being an array, but instead, the function's own error message complaining that one of the "parameters" (meaning one of the items of the $attributes array passed as a second argument) is an array. And still I need to figure out which one.
Your Environment
PHP 7.4
Debian 10
The text was updated successfully, but these errors were encountered:
Description
Consider the function
newrelic_record_custom_events($name, $attributes)
.If one of the elements of the
$attributes
array is itself an array, which is not supported, the error message is very confusing.See details below.
Steps to Reproduce
Run this:
Note that I'm passing an invalid set of attributes as the second parameter, given that the element
bar
is an array while only scalar attributes are supported.Expected Behavior
I expect to get an error message something like this:
I am very bad at phrasing error messages and you can phrase the message however you please, but the bare minimum amount of information that I demand is as above.
In particular:
Observed Behavior
The error message actually thrown is this:
which sucks because it lacks all the information mentioned above.
This message is extremely confusing because it looks very similar to PHP's native error message
so I'm induced to immediately inspect the two arguments that I passed to the function (and I'm already irritated that it's not telling me which one is the problematic one), and since the first one (the event name) is the one that is actually expected to be scalar, I'm thinking that I accidentally passed an array for the event name. So this is misleading me.
It took me a long while to realize that this was not PHP's native error message complaining about one of the two arguments passed to the function not being an array, but instead, the function's own error message complaining that one of the "parameters" (meaning one of the items of the
$attributes
array passed as a second argument) is an array. And still I need to figure out which one.Your Environment
The text was updated successfully, but these errors were encountered: