From: Michael Date: Sat, 13 Oct 2018 13:17:10 +0000 (+0000) Subject: Catching error when compacting doesn't work X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d23386f9b2a556eb852da7e03a7f0002ce6b24d3;p=friendica.git Catching error when compacting doesn't work --- diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index cf23276d75..5380c3c542 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -92,7 +92,14 @@ class JsonLD $jsonobj = json_decode(json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); - $compacted = jsonld_compact($jsonobj, $context); + + try { + $compacted = jsonld_compact($jsonobj, $context); + } + catch (Exception $e) { + $compacted = false; + logger('compacting error:' . print_r($e, true), LOGGER_DEBUG); + } return json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true); }