Fix incorrect array encoding in config produced by RollbarJsHelper
When building JS code with RollbarJsHelper and passing configuration parameters that are arrays, those arrays in the final JS output are incorrectly encoded as objects.
Thanks for taking the time to submit this! I agree; the current code seems buggy.
Digging a little, looks like JSON_FORCE_OBJECT was introduced back in 2017 by @rokob. I think the intent of that change was to ensure the configuration object at the highest level was always an object, but it seems to have neglected the side effect of forcing deep PHP arrays to JSON objects (eg, a configuration of [ "a" => [ ] ] produces {"a":{}} instead of the desired {"a":[]}.
We'll get this in the pipeline for change soon.
Yeah I was trying to only force the top-level to be an object. PHP never ceases to amaze me. I see now in the docs that there is a user comment about this behavior. Although the main docs don't mention anything about this being applied to the entire structure:
JSON_FORCE_OBJECT (int) Outputs an object rather than an array when a non-associative array is used. Especially useful when the recipient of the output is expecting an object and the array is empty. Available as of PHP 5.3.0.
I have fixed merge conflicts.
There seems some issue with CI, but it is possibly one-off as I am unable to reproduce it.