Description
Bug report
Summary
If there's some invalid UTF-8 sequences in a table that you're listing through a connector/processor, that may crap out with an error like this:
Processor failed creating output array due to JSON error 5
Now that MODX 3 requires at least 7.2, we can adjust how we encode JSON to make it more forgiving by adjusting the flags passed to json_encode in the base Processor class (outputArray() method), from:
$output = json_encode(array(
'success' => true,
'total' => $count,
'results' => $array
));
To:
$output = json_encode(array(
'success' => true,
'total' => $count,
'results' => $array
), JSON_INVALID_UTF8_SUBSTITUTE);
With that it wont fail entirely, but instead will substitute the invalid sequence with the boxed question mark.
(This can't be applied to 2.x because this flag was added in PHP 7.2.)
Step to reproduce
I don't really know how to break UTF-8 sequences on purpose to be honest. But It Happens (tm).
Observed behavior
Error message and no response.
Expected behavior
No error message, response containing the boxed question mark where the invalid character was.
Related issue(s)/PR(s)
N/a. Prompted by modmore ticket 29288.
Environment
Irrelevant.