I've been debugging a test that only fails in CI and found that it's due to an HHVM glitch. JsonContent calls FormatJson::parse, which calls the native json_decode and checks for errors. Here's my test script and output on different environments,
$badJson = '"foo": b }'; $decoded = json_decode( $badJson, true ); $error = json_last_error(); print( var_export( $decoded, true ) . "\n" ); print( var_export( $error , true ) . "\n" );
On Zend PHP 7.1.16, the output is:
NULL 4
With HHVM 3.18.6-dev, I get:
'foo' 0
Note that both evaluation engines correctly throw errors for a test string 'foo: b }', so I'm assuming the edge case has to do with a valid JSON item coming at the beginning of the string, and HHVM ignoring the "leftovers".