Fix a few parsing bugs that can allow for silent truncation of valid JSON
Test case for Redmine 6369

Shows that array data accumluates over multiple bundle
invocations.
Clear array data before calling bundle as method

This re-establishes the behavior from 3.5.3, where array
data within a sub-bundle does not accumulate accross
multiple bundle invokations via methods promises.

It maintains the behavior where such data does accumulate
accross multiple bundle invokations via bundlesequence.

One could argue that the behavior or data accumulating would
be consistent with the declarative nature of CFEngine, but
given that CFEngine provides no means to clear an array in a
controlled way, this would require a uniquely named array for
each bundle invocation, which would be unmaintainable and render
methods promises and bundles useless as a means for abstraction.

Fixes Redmine #6369, see ticket for more detailed discussion.
Disable caching for functions that populate array

The function populates an array, so skipping the function call
is not an option, as the cached return value is not sufficient.

A second call of the same method (2nd pass) would first clear
the array and then skip the function call, leaving an empty
array.
Merge branch 'bug/json-parser' of git://github.com/worr/core
Add unit test cases for trailing commas in JSON structures.
Merge pull request #2010 from vohi/redmine/6369

Redmine/6369