]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #6697 from annando/memory-jsonld
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Tue, 19 Feb 2019 08:40:01 +0000 (09:40 +0100)
committerGitHub <noreply@github.com>
Tue, 19 Feb 2019 08:40:01 +0000 (09:40 +0100)
Avoid memory issue in exception of JSON-LD parser

src/Util/JsonLD.php

index 8cc9f274d903f25a56561c5c3259c442b2e0e6e9..ec68375d65dca8dc5e3c027af387c95772dca69a 100644 (file)
@@ -68,7 +68,7 @@ class JsonLD
                }
                catch (Exception $e) {
                        $normalized = false;
-                       Logger::log('normalise error:' . print_r($e, true), Logger::DEBUG);
+                       Logger::log('normalise error:' . substr(print_r($e, true), 0, 10000), Logger::DEBUG);
                }
 
                return $normalized;
@@ -115,7 +115,7 @@ class JsonLD
                }
                catch (Exception $e) {
                        $compacted = false;
-                       Logger::log('compacting error:' . print_r($e, true), Logger::DEBUG);
+                       Logger::log('compacting error:' . substr(print_r($e, true), 0, 10000), Logger::DEBUG);
                }
 
                $json = json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true);