- Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-
1357768936
* @return array Compacted JSON array
* @throws Exception
*/
- public static function compact($json, bool $logfailed = true)
+ public static function compact($json, bool $logfailed = true): array
{
jsonld_set_document_loader('Friendica\Util\JsonLD::documentLoader');
$json = json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true);
+ if ($json === false) {
+ Logger::notice('JSON encode->decode failed', ['orig_json' => $orig_json, 'compacted' => $compacted]);
+ $json = [];
+ }
+
return $json;
}