From 4292f9fd57bf9869a256674ce3bec938ec11e4ec Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Fri, 3 Mar 2023 20:07:18 +0000
Subject: [PATCH] prevent php8 warnings, fixes #2261

Closes #2261

Merge request studip/studip!1491
---
 lib/phplib/Seminar_Auth.class.php | 10 +++++-----
 public/index.php                  |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/phplib/Seminar_Auth.class.php b/lib/phplib/Seminar_Auth.class.php
index 3a915e56fb1..fd3080fe142 100644
--- a/lib/phplib/Seminar_Auth.class.php
+++ b/lib/phplib/Seminar_Auth.class.php
@@ -382,12 +382,12 @@ class Seminar_Auth
      */
     function auth_set_user_settings($user)
     {
-        $divided = explode("x", Request::get('resolution'));
-        $this->auth["xres"] = ($divided[0] != 0) ? (int)$divided[0] : 1024; //default
-        $this->auth["yres"] = ($divided[1] != 0) ? (int)$divided[1] : 768; //default
+        $divided = explode('x', Request::get('resolution'));
+        $this->auth["xres" . ""] = !empty($divided[0]) ? (int) $divided[0] : 1024; //default
+        $this->auth['yres'] = !empty($divided[1]) ? (int)$divided[1] : 768; //default
         // Change X-Resulotion on Multi-Screen Systems (as Matrox Graphic-Adapters are)
-        if (($this->auth["xres"] / $this->auth["yres"]) > 2) {
-            $this->auth["xres"] = $this->auth["xres"] / 2;
+        if ($this->auth['xres'] / $this->auth['yres'] > 2) {
+            $this->auth['xres'] = $this->auth['xres'] / 2;
         }
         $user = User::toObject($user);
         //restore user-specific language preference
diff --git a/public/index.php b/public/index.php
index 4cc7a8721f3..429a35e9b0c 100644
--- a/public/index.php
+++ b/public/index.php
@@ -43,7 +43,7 @@ if (Request::get('set_language')) {
 // store user-specific language preference
 if ($auth->is_authenticated() && $user->id != 'nobody') {
     // store last language click
-    if (mb_strlen($_SESSION['forced_language'])) {
+    if (!empty($_SESSION['forced_language'])) {
         $query = "UPDATE user_info SET preferred_language = ? WHERE user_id = ?";
         $statement = DBManager::get()->prepare($query);
         $statement->execute([$_SESSION['forced_language'], $user->id]);
-- 
GitLab