From 54e80c9b73e339423575ff120a865b5268c60e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Sch=C3=BCttl=C3=B6ffel?= <schuettloeffel@zqs.uni-hannover.de> Date: Tue, 10 Aug 2021 10:09:26 +0000 Subject: [PATCH] OpenGraph: surpress warnings when fetching, abort on fail --- lib/models/OpenGraphURL.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/models/OpenGraphURL.class.php b/lib/models/OpenGraphURL.class.php index fcb495fa521..5df5e7f1030 100644 --- a/lib/models/OpenGraphURL.class.php +++ b/lib/models/OpenGraphURL.class.php @@ -172,7 +172,12 @@ class OpenGraphURL extends SimpleORMap ], ]); - $content = file_get_contents($this['url'], false, $context); + $content = @file_get_contents($this['url'], false, $context); + + if ($content === false) { + return; + } + $content = mb_encode_numericentity($content, [0x80, 0xffff, 0, 0xffff], $currentEncoding); $old_libxml_error = libxml_use_internal_errors(true); $doc = new DOMDocument(); -- GitLab