From ccabee1bf04881fe9f847cfb33691d9a7b757065 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Tue, 4 Apr 2023 08:04:46 +0000
Subject: [PATCH] fixes #2508

Closes #2508

Merge request studip/studip!1696
---
 lib/models/OERHost.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/models/OERHost.php b/lib/models/OERHost.php
index 27de21a3aaf..bf8f483087e 100644
--- a/lib/models/OERHost.php
+++ b/lib/models/OERHost.php
@@ -99,7 +99,7 @@ class OERHost extends OERIdentity
     public function fetchPublicKey()
     {
         $endpoint_url = $this['url']."fetch_public_host_key";
-        $endpoint_url .= "?from=".urlencode($GLOBALS['oer_PREFERRED_URI'] ?: $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/");
+        $endpoint_url .= "?from=".urlencode($GLOBALS['oer_PREFERRED_URI'] ?? $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/");
         $host_data = @file_get_contents($endpoint_url, false, get_default_http_stream_context($endpoint_url));
         if ($host_data) {
             $host_data = json_decode($host_data, true);
@@ -123,9 +123,9 @@ class OERHost extends OERIdentity
     public function askKnownHosts()
     {
         $endpoint_url = $this['url']."fetch_known_hosts"
-            ."?from=".urlencode(!empty($GLOBALS['oer_PREFERRED_URI']) ?: $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/");
+            ."?from=".urlencode($GLOBALS['oer_PREFERRED_URI'] ?? $GLOBALS['ABSOLUTE_URI_STUDIP']."dispatch.php/oer/endpoints/");
         $output = @file_get_contents($endpoint_url, false, get_default_http_stream_context($endpoint_url));
-        if (!empty($output)) {
+        if ($output) {
             $output = json_decode($output, true);
             foreach ((array) $output['hosts'] as $host_data) {
                 $host = OERHost::findOneByUrl($host_data['url']);
-- 
GitLab