]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #5901 from annando/catch-error
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 13 Oct 2018 14:52:18 +0000 (10:52 -0400)
committerGitHub <noreply@github.com>
Sat, 13 Oct 2018 14:52:18 +0000 (10:52 -0400)
Catching error when compacting doesn't work

src/Util/JsonLD.php

index cf23276d7529a8c8e3be0f98162e72bcde9d3733..5380c3c542734bb613aa4238fc960d8a755ceb4a 100644 (file)
@@ -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);
        }