X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FJsonLD.php;h=427205958f846d5bfa7ac101d751a88fba0d39bf;hb=4097808b95dcdac41fd4146a560eb6f941891c94;hp=25ce74fcc7c1c044cebc7843f953e361e0a4baac;hpb=d989602c1c398e350d5b8c860b8788e08a0ab1b4;p=friendica.git diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index 25ce74fcc7..427205958f 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -1,6 +1,6 @@ $url]); @@ -140,7 +152,7 @@ class JsonLD * @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'); @@ -203,6 +215,11 @@ class JsonLD $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; }