From 710f175b5618672ace2c0771f6b6b31922bfcc66 Mon Sep 17 00:00:00 2001 From: David Siegfried <david.siegfried@uni-vechta.de> Date: Sun, 12 Mar 2023 17:33:06 +0000 Subject: [PATCH] prevent php8 warnings, closes #2361 Closes #2361 Merge request studip/studip!1544 --- lib/models/OpenGraphURL.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/models/OpenGraphURL.class.php b/lib/models/OpenGraphURL.class.php index 19ea6146e0a..a1d4c721003 100644 --- a/lib/models/OpenGraphURL.class.php +++ b/lib/models/OpenGraphURL.class.php @@ -159,7 +159,7 @@ class OpenGraphURL extends SimpleORMap $isOpenGraph = false; $response = FileManager::fetchURLMetadata($this['url']); - if ($response['response_code'] == 200 && mb_strpos($response['Content-Type'],'html') !== false) { + if ((int)$response['response_code'] === 200 && isset($response['Content-Type']) && mb_strpos($response['Content-Type'],'html') !== false) { if (preg_match('/(?<=charset=)[^;]*/i', $response['Content-Type'], $match)) { $currentEncoding = trim($match[0], '"'); } else { @@ -214,13 +214,13 @@ class OpenGraphURL extends SimpleORMap $this[$key] = $tag; } } - if (!$this['title'] && $isOpenGraph) { + if (empty($this['title']) && $isOpenGraph) { $titles = $doc->getElementsByTagName('title'); if ($titles->length > 0) { $this['title'] = $titles->item(0)->textContent; } } - if (!$this['description'] && $isOpenGraph) { + if (empty($this['description']) && $isOpenGraph) { foreach ($metatags as $tag) { if (mb_stripos($tag->getAttribute('name'), "description") !== false || mb_stripos($tag->getAttribute('property'), "description") !== false) -- GitLab