diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2021-08-10 10:09:26 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2021-08-10 10:09:26 +0000 |
| commit | 54e80c9b73e339423575ff120a865b5268c60e72 (patch) | |
| tree | f752b48fd53a245aff9a7caee179db56fa861caf /lib/models/OpenGraphURL.class.php | |
| parent | e3161ffe20341a9780420c09ce80356143e0dbdb (diff) | |
OpenGraph: surpress warnings when fetching, abort on fail
Diffstat (limited to 'lib/models/OpenGraphURL.class.php')
| -rw-r--r-- | lib/models/OpenGraphURL.class.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/models/OpenGraphURL.class.php b/lib/models/OpenGraphURL.class.php index fcb495f..5df5e7f 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(); |
