diff --git a/app/controllers/course/basicdata.php b/app/controllers/course/basicdata.php
index 8a32bc348857461ed76c11fcb89c6c6fcfef5ef1..708e8db49f6216a39b37e33c96b5b0e6f5233a39 100644
--- a/app/controllers/course/basicdata.php
+++ b/app/controllers/course/basicdata.php
@@ -369,6 +369,7 @@ class Course_BasicdataController extends AuthenticatedController
              $this->url_for('avatar/update/course', $course_id),
              Icon::create('edit')
         );
+
         if ($this->deputies_enabled) {
             if (Deputy::isDeputy($GLOBALS['user']->id, $this->course_id)) {
                 $newstatus = 'dozent';
@@ -376,11 +377,16 @@ class Course_BasicdataController extends AuthenticatedController
             } else if (in_array($GLOBALS['user']->id, array_keys($this->dozenten)) && count($this->dozenten) > 1) {
                 $newstatus = 'deputy';
                 $text = _('Vertretung werden');
+            } else {
+                $newstatus = '';
+                $text = '';
+            }
+            if ($newstatus !== '' && $text !== '') {
+                $widget->addLink($text,
+                    $this->url_for('course/basicdata/switchdeputy', $this->course_id, $newstatus),
+                    Icon::create('persons')
+                );
             }
-            $widget->addLink($text,
-                 $this->url_for('course/basicdata/switchdeputy', $this->course_id, $newstatus),
-                 Icon::create('persons')
-            );
         }
         $sidebar->addWidget($widget);
         if ($GLOBALS['perm']->have_studip_perm('admin', $this->course_id)) {
diff --git a/app/controllers/course/files.php b/app/controllers/course/files.php
index 6cfef6e750d8c58149d29e372c91bc714a5a515f..2cb69a881d1997f31cd5bc6d977a33ee2fa19021 100644
--- a/app/controllers/course/files.php
+++ b/app/controllers/course/files.php
@@ -194,6 +194,8 @@ class Course_FilesController extends AuthenticatedController
         //find all files in all subdirectories:
         list($this->files, $this->folders) = array_values(FileManager::getFolderFilesRecursive($this->topFolder, $GLOBALS['user']->id));
 
+        $this->table_title = '';
+        $this->pagination_html = '';
         $this->range_type = 'course';
         $this->show_default_sidebar = true;
         $this->form_action = $this->url_for('file/bulk/' . $folder->getId());
diff --git a/app/controllers/course/studygroup.php b/app/controllers/course/studygroup.php
index b327a1afcb37538ad06f2a1f879e8533448d9caa..fc55bf560a1d484920d972afff169ad25deb54af 100644
--- a/app/controllers/course/studygroup.php
+++ b/app/controllers/course/studygroup.php
@@ -48,7 +48,7 @@ class Course_StudygroupController extends AuthenticatedController
         }
 
         // Obtain default view
-        $default_view = $user_cfg[$course_id] ?: 'gallery';
+        $default_view = $user_cfg[$course_id] ?? 'gallery';
         $view = Request::option('view', $default_view);
         if (!in_array($view, words('gallery list'))) {
             $view = 'gallery';
@@ -91,7 +91,11 @@ class Course_StudygroupController extends AuthenticatedController
             $stmt->execute([$GLOBALS['user']->id, $id]);
             $data = $stmt->fetch();
 
-            $membership_requested = $data['status'] === 'accepted';
+            if (isset($data['status'])) {
+                $membership_requested = $data['status'] === 'accepted';
+            } else {
+                $membership_requested = false;
+            }
             $invited = StudygroupModel::isInvited($GLOBALS['user']->id, $id);
 
             if (!preg_match('/^(' . preg_quote($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'], '/') . ')?([a-zA-Z0-9_-]+\.php)([a-zA-Z0-9_?&=-]*)$/', Request::get('send_from_search_page'))) {
@@ -510,7 +514,7 @@ class Course_StudygroupController extends AuthenticatedController
         $this->sem_class        = $sem->getSemClass();
         $this->invitedMembers   = StudygroupModel::getInvitations($id);
         $this->rechte           = $GLOBALS['perm']->have_studip_perm('tutor', $id);
-
+        $this->page = null;
         $this->setupMembersSidebar($sem);
     }
 
diff --git a/app/controllers/file.php b/app/controllers/file.php
index f41d87ba0b69243dcd1292b20e0df6d41b1067e7..e4c09d36cfc96451ff3d9e511594c73736225b00 100644
--- a/app/controllers/file.php
+++ b/app/controllers/file.php
@@ -874,7 +874,7 @@ class FileController extends AuthenticatedController
                 $this->to_folder_type = new StandardFolder($folder);
             }
         }
-
+        $this->filesystemplugin = null;
         if (Request::get('to_plugin')) {
             $folder_id = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], "dispatch.php/file/choose_folder") + strlen("dispatch.php/file/choose_folder"));
             if (strpos($folder_id, "?") !== false) {
@@ -1333,6 +1333,7 @@ class FileController extends AuthenticatedController
 
     public function choose_file_action($folder_id = null)
     {
+        $this->filesystemplugin = null;
         if (Request::get('to_plugin')) {
             $to_plugin = PluginManager::getInstance()->getPlugin(Request::get('to_plugin'));
             $this->to_folder_type = $to_plugin->getFolder(Request::get('to_folder_id', ''));
@@ -1673,6 +1674,7 @@ class FileController extends AuthenticatedController
     public function add_url_action($folder_id)
     {
         $this->content_terms_of_use_entries = ContentTermsOfUse::findAll();
+        $this->content_terms_of_use_id = Request::get('content_terms_of_use_id');
         if (Request::get("to_plugin")) {
             $folder_id = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], "dispatch.php/file/add_url/") + strlen("dispatch.php/file/add_url/"));
             if (strpos($folder_id, "?") !== false) {
@@ -1780,6 +1782,7 @@ class FileController extends AuthenticatedController
             ];
         }
 
+        $new_folder = null;
         if (Request::submitted('create') || Request::submitted('force_creation')) {
             CSRFProtection::verifyUnsafeRequest();
 
diff --git a/app/controllers/files.php b/app/controllers/files.php
index aaa26ef5669f4140d6e5e0535a4b5344dcf10da1..9ed804f5ae57ef61e08b9b8cbb503b2061586f80 100644
--- a/app/controllers/files.php
+++ b/app/controllers/files.php
@@ -627,7 +627,8 @@ class FilesController extends AuthenticatedController
         if (!$folder) {
             throw new Exception(_('Fehler beim Laden des Hauptordners!'));
         }
-
+        $this->table_title = '';
+        $this->pagination_html = '';
         $this->topFolder = $folder->getTypedFolder();
         $this->form_action = $this->link_for('file/bulk/' . $this->topFolder->getId());
         $this->show_default_sidebar = true;
diff --git a/app/controllers/institute/files.php b/app/controllers/institute/files.php
index 9f2cdd5559bf6b012b27f1a41f48107c093c8f87..6f622ae8bf11db56d460ad4d0285631560d88fee 100644
--- a/app/controllers/institute/files.php
+++ b/app/controllers/institute/files.php
@@ -148,6 +148,8 @@ class Institute_FilesController extends AuthenticatedController
         //find all files in all subdirectories:
         list($this->files, $this->folders) = array_values(FileManager::getFolderFilesRecursive($this->topFolder, $GLOBALS['user']->id));
 
+        $this->table_title = '';
+        $this->pagination_html = '';
         $this->range_type = 'institute';
         $this->show_default_sidebar = true;
         $this->enable_table_filter = true;
diff --git a/app/controllers/messages.php b/app/controllers/messages.php
index 38f0d23704c1a74a73de205dd2c71f4049645ccf..274e2eb27da78136780c83df7b669797c05a9c7d 100644
--- a/app/controllers/messages.php
+++ b/app/controllers/messages.php
@@ -141,6 +141,8 @@ class MessagesController extends AuthenticatedController {
         $attachment_folder = Folder::findOneByRange_id($this->message->id);
         if ($attachment_folder) {
             $this->attachment_folder = $attachment_folder->getTypedFolder();
+        } else {
+            $this->attachment_folder = null;
         }
 
 
diff --git a/app/controllers/resources/booking.php b/app/controllers/resources/booking.php
index 47ddd4ca443be59f7ad52fd42e576e1dd53bdbd5..d05862d78777c1d6dde74a72c9c1072d1e211117 100644
--- a/app/controllers/resources/booking.php
+++ b/app/controllers/resources/booking.php
@@ -54,6 +54,7 @@ class Resources_BookingController extends AuthenticatedController
                 'autor'
             );
         }
+        $this->no_reload = Request::submitted('no_reload');
     }
 
 
@@ -922,17 +923,15 @@ class Resources_BookingController extends AuthenticatedController
         foreach ($this->resources as $resource) {
             //Check if the resource is a room and if the room is part of a
             //separable room.
+            //We must display a warning.
 
             if ($resource instanceof Room) {
                 $other_room_parts = Room::findOtherRoomParts($resource);
-
+                $simple_message = true;
                 if ($other_room_parts) {
                     $this->other_room_parts[$resource->id] = $other_room_parts;
                     $this->separable_rooms_selected = true;
 
-                    //We must display a warning.
-                    $simple_message = true;
-
                     if ($only_one_room and $other_room_parts) {
                         //If there is only one room we can be informative.
                         $simple_message = false;
diff --git a/app/controllers/resources/room_request.php b/app/controllers/resources/room_request.php
index e15a432a244f93162cbe38c6978a88b79a3a05fd..050cf174e925e64ca189a5df39d33f43da5cca86 100644
--- a/app/controllers/resources/room_request.php
+++ b/app/controllers/resources/room_request.php
@@ -339,17 +339,19 @@ class Resources_RoomRequestController extends AuthenticatedController
         $sql .= " GROUP BY resource_requests.id ";
 
         // if table should be sorted by marking state
-        switch ($this->filter['sorting']) {
-            case 1:
-                $sql .= " ORDER BY resource_requests.marked ";
-                break;
-            case 10:
-                $sql .= " ORDER BY resource_requests.chdate ";
-                break;
-            default:
-                $sql .= " ORDER BY mkdate ";
-        }
-        $sql .= $this->filter['sort_order'] === 'desc' ? 'DESC' : 'ASC';
+        if (isset($this->filter['sorting'])) {
+            switch ($this->filter['sorting']) {
+                case 1:
+                    $sql .= " ORDER BY resource_requests.marked ";
+                    break;
+                case 10:
+                    $sql .= " ORDER BY resource_requests.chdate ";
+                    break;
+                default:
+                    $sql .= " ORDER BY mkdate ";
+            }
+            $sql .= $this->filter['sort_order'] === 'desc' ? 'DESC' : 'ASC';
+        }
 
         $requests = RoomRequest::findBySql($sql, $sql_params);
         $result = [];
@@ -2657,7 +2659,7 @@ class Resources_RoomRequestController extends AuthenticatedController
             $element = new SelectElement(
                 $class_id,
                 $class['name'],
-                $this->filter['course_type'] === (string)$class_id
+                isset($this->filter['course_type']) && ($this->filter['course_type'] === (string)$class_id)
             );
             $list->addElement(
                 $element->setAsHeader(),
@@ -2668,7 +2670,7 @@ class Resources_RoomRequestController extends AuthenticatedController
                 $element = new SelectElement(
                     $class_id . '_' . $id,
                     $result['name'],
-                    $this->filter['course_type'] === $class_id . '_' . $id
+                    isset($this->filter['course_type']) && ($this->filter['course_type'] === $class_id . '_' . $id)
                 );
                 $list->addElement(
                     $element->setIndentLevel(1),
@@ -2698,7 +2700,7 @@ class Resources_RoomRequestController extends AuthenticatedController
         $widget->addElement(new WidgetElement('<br>'));
         $widget->addCheckbox(
             _('Nur mit Raumangabe'),
-            $this->filter['specific_requests'],
+            !empty($this->filter['specific_requests']),
             $this->planningURL(['toggle_specific_requests' => 1])
         );
         $widget->addCheckbox(
@@ -2710,7 +2712,7 @@ class Resources_RoomRequestController extends AuthenticatedController
 
         $this->requests = $this->getFilteredRoomRequests();
 
-        if ($this->filter['room_id']) {
+        if (!empty($this->filter['room_id'])) {
             $this->resource = Resource::find($this->filter['room_id']);
             if (!$this->resource) {
                 PageLayout::postError(
diff --git a/app/views/admin/sem_classes/details.php b/app/views/admin/sem_classes/details.php
index 6cbfed3eb56303d413e40345addbaecae9ee145c..b6b8a35ee12b05a37dd9e386f847c48500749e93 100644
--- a/app/views/admin/sem_classes/details.php
+++ b/app/views/admin/sem_classes/details.php
@@ -220,8 +220,8 @@
                             'plugin' => $module_info,
                             'sem_class' => $sem_class,
                             'plugin_id' => $module_name,
-                            'activated' => $sem_class['modules'][$module_name]['activated'],
-                            'sticky' => $sem_class['modules'][$module_name]['sticky']
+                            'activated' => $sem_class['modules'][$module_name]['activated'] ?? false,
+                            'sticky' => $sem_class['modules'][$module_name]['sticky'] ?? false,
                         ]
                     )?>
                 <? endforeach ?>
diff --git a/app/views/course/overview/index.php b/app/views/course/overview/index.php
index 8fc61b77e2842850563e45cb43252ad3af180457..39d801d9dba9b399726afeaadc43550b3566a406 100644
--- a/app/views/course/overview/index.php
+++ b/app/views/course/overview/index.php
@@ -55,15 +55,23 @@
 <?php
 
 // Anzeige von News
-echo $news;
+if (!empty($news)) {
+    echo $news;
+}
 
 // Anzeige von Terminen
-echo $dates;
+if (!empty($dates)) {
+    echo $dates;
+}
 
 // Anzeige von Umfragen
-echo $evaluations;
+if (!empty($evaluations)) {
+    echo $evaluations;
+}
 
-echo $questionnaires;
+if (!empty($questionnaires)) {
+    echo $questionnaires;
+}
 
 // display plugins
 
diff --git a/app/views/course/statusgroups/index.php b/app/views/course/statusgroups/index.php
index 2f75624656a957e7f23e1c9722861c2514d28fab..d420de24f859470f0a3554c0a0c6c40d80d029ab 100644
--- a/app/views/course/statusgroups/index.php
+++ b/app/views/course/statusgroups/index.php
@@ -10,7 +10,7 @@
             'members'     => $group['members'],
             'joinable'    => $group['joinable'],
             'invisible'   => $group['invisible_users'],
-            'load'        => $open_groups ? true : $group['load'],
+            'load'        => $open_groups ? true : $group['load'] ?? true,
             'order'       => $order,
             'sort_by'     => $sort_by,
             'open_group'  => $open_groups,
diff --git a/app/views/file/add_files_window.php b/app/views/file/add_files_window.php
index 0973ed8e647cdab93194af85cd36388cfa5d9ebe..53a7b73f6275093986f5dfdcf7e45713f44720db 100644
--- a/app/views/file/add_files_window.php
+++ b/app/views/file/add_files_window.php
@@ -14,7 +14,7 @@ if ($folder_id) {
 }
 
 ?>
-<div class="files_source_selector" data-folder_id="<?= htmlReady($folder_id) ?>" <? if ($hidden) echo ' style="display: none;"'; ?>>
+<div class="files_source_selector" data-folder_id="<?= htmlReady($folder_id) ?>" <? if (!empty($hidden)) echo ' style="display: none;"'; ?>>
     <h2 class="dialog-subtitle"><?= _('Quelle auswählen') ?></h2>
     <div class="file_select_possibilities">
         <? if ($range instanceof Course && !$range->getSemClass()['studygroup_mode'] && $GLOBALS['perm']->have_studip_perm('tutor', $range->id)
diff --git a/app/views/file/edit_license.php b/app/views/file/edit_license.php
index 0ca27b2c7882e503ee99ef9b3587b52b0ebc9a33..ebd5ff01de4cdd8b629d64e7ec914ca11a684584 100644
--- a/app/views/file/edit_license.php
+++ b/app/views/file/edit_license.php
@@ -1,4 +1,4 @@
-<form action="<?= $controller->link_for('file/edit_license', $origin_folder_id) ?>"
+<form action="<?= $controller->link_for('file/edit_license', $origin_folder_id ?? null) ?>"
       method="post" class="default" data-dialog="reload-on-close">
 <input type="hidden" name="re_location" value="<?= htmlReady($re_location) ?>">
 <? foreach ($file_refs as $file_ref) : ?>
@@ -23,4 +23,4 @@
             $controller->url_for((in_array($folder->range_type, ['course', 'institute']) ? $folder->range_type . '/' : '') . 'files/index/' . $folder->id)
         ) ?>
     </footer>
-</form>
\ No newline at end of file
+</form>
diff --git a/app/views/resources/booking/_add_edit_form.php b/app/views/resources/booking/_add_edit_form.php
index fc59350201cb47015d32569740865906607d6444..c35f405db1c0dd57f62e5a7603caa6ebb53d5fba 100644
--- a/app/views/resources/booking/_add_edit_form.php
+++ b/app/views/resources/booking/_add_edit_form.php
@@ -7,7 +7,7 @@
           ?>"
           data-dialog="<?= $no_reload ? 'size=auto' : 'reload-on-close' ?>">
         <input type="hidden" name="origin_url"
-               value="<?= htmlReady($origin_url) ?>">
+               value="<?= htmlReady($origin_url??'') ?>">
         <? if ($resources) : ?>
             <? foreach ($resources as $resource): ?>
                 <input type="hidden" name="resource_ids[]"
@@ -434,7 +434,7 @@
         <div class="fieldset-row">
             <fieldset>
                 <legend><?= _('Personen') ?></legend>
-                <? if ($booking->assigned_user instanceof User): ?>
+                <? if ($booking && $booking->assigned_user instanceof User): ?>
                     <p>
                         <a href="<?= $controller->link_for(
                             'profile',
@@ -474,7 +474,7 @@
                         </div>
                     </label>
                 <? endif ?>
-                <? if ($booking->booking_user): ?>
+                <? if ($booking && $booking->booking_user): ?>
                     <p style="margin-top:1em;margin-bottom:0;">
                         <?= htmlReady(
                             _('Gebucht von:')
@@ -508,7 +508,7 @@
             <fieldset class="description">
                 <legend><?= _('Buchungstext') ?></legend>
                 <label>
-                    <textarea name="description" <?= !$show_booking_type_selection ? 'autofocus' : ''?>><?= htmlReady($description) ?></textarea>
+                    <textarea name="description" <?= !$show_booking_type_selection ? 'autofocus' : ''?>><?= htmlReady($description ?? '') ?></textarea>
                 </label>
             </fieldset>
         </div>
diff --git a/app/views/resources/resource/permissions.php b/app/views/resources/resource/permissions.php
index 02cf057ff8ade88f16dfd27f55502adaad31c490..e7a1bc9a5eb0bf235fc7992456587911032c4c9e 100644
--- a/app/views/resources/resource/permissions.php
+++ b/app/views/resources/resource/permissions.php
@@ -1,7 +1,6 @@
 <form class="default" method="post"
-      action="<?= ($custom_form_action_link
-          ? $custom_form_action_link
-          : ($single_user_mode
+      action="<?= (!empty($custom_form_action_link)
+          ? $custom_form_action_link : ($single_user_mode
               ? $resource->getActionLink(
                   'permissions',
                   [
diff --git a/app/views/resources/room_request/planning.php b/app/views/resources/room_request/planning.php
index 20e9efb33a2c81d4f02304bb824c9adb0e00dc0e..7ecf32385941b6c5e8413f025946752dadb8ad4b 100644
--- a/app/views/resources/room_request/planning.php
+++ b/app/views/resources/room_request/planning.php
@@ -5,14 +5,14 @@
         <select name="room_id" aria-labelledby="<?= _('Bitte wählen Sie einen Raum aus') ?>" onchange="this.form.submit()">
             <option value=""><?= _('Bitte wählen') ?></option>
             <? foreach ($this->available_rooms as $room) : ?>
-                <option value="<?= $room->id ?>" <?= $resource && $resource->id === $room->id ? 'selected' : '' ?>>
+                <option value="<?= $room->id ?>" <?= !empty($resource) && $resource->id === $room->id ? 'selected' : '' ?>>
                     <?= htmlReady($room->name) ?>
                 </option>
             <? endforeach ?>
         </select>
     </fieldset>
 </form>
-<? if ($resource): ?>
+<? if (!empty($resource)): ?>
     <?
     $min_time = Config::get()->INSTITUTE_COURSE_PLAN_START_HOUR . ':00';
     $max_time = Config::get()->INSTITUTE_COURSE_PLAN_END_HOUR . ':00';
@@ -64,7 +64,7 @@
         _('Semesterplan'),
         [
             'editable'           => true,
-            'selectable'         => ($fullcalendar_studip_urls['add'] != null),
+            'selectable'         => isset($fullcalendar_studip_urls['add']),
             'studip_urls'        => $fullcalendar_studip_urls,
             'minTime'            => ($min_time),
             'maxTime'            => ($max_time),
@@ -300,6 +300,6 @@
     </form>
 <? endif ?>
 
-<? if (!$requests && $resource) : ?>
+<? if (!$requests && !empty($resource)) : ?>
     <?= MessageBox::info(_('Es sind keine Anfragen vorhanden!')) ?>
-<? endif ?>
\ No newline at end of file
+<? endif ?>
diff --git a/lib/classes/Icon.class.php b/lib/classes/Icon.class.php
index 30d3f3a4317705efcbf23a346c2e73c4e066a60e..f2e4fa5dd81803bd4b993d9b0ed33c049987bc50 100644
--- a/lib/classes/Icon.class.php
+++ b/lib/classes/Icon.class.php
@@ -368,7 +368,9 @@ class Icon
     {
         $size = $size ?: Icon::DEFAULT_SIZE;
         if (isset($this->attributes['size'])) {
-            list($size, $temp) = explode('@', $this->attributes['size'], 2);
+            $parts =  explode('@', $this->attributes['size'], 2);
+            $size = $parts[0];
+            $temp = $parts[1] ?? null;
             unset($this->attributes['size']);
         }
         return (int)$size;
diff --git a/lib/classes/MultiPersonSearch.class.php b/lib/classes/MultiPersonSearch.class.php
index eafcdbb529a5ab01eda9177aa77cf8e68370c0b1..db984c770388169228d31aa7db300a42bd5f8a35 100644
--- a/lib/classes/MultiPersonSearch.class.php
+++ b/lib/classes/MultiPersonSearch.class.php
@@ -491,17 +491,17 @@ class MultiPersonSearch {
      */
     public function restoreFromSession() {
         if (isset($_SESSION['multipersonsearch'][$this->name])) {
-            $this->title = $_SESSION['multipersonsearch'][$this->name]['title'];
-            $this->description = $_SESSION['multipersonsearch'][$this->name]['description'];
-            $this->quickfilterIds = $_SESSION['multipersonsearch'][$this->name]['quickfilterIds'];
-            $this->additionalHMTL = $_SESSION['multipersonsearch'][$this->name]['additionalHMTL'];
-            $this->executeURL = html_entity_decode($_SESSION['multipersonsearch'][$this->name]['executeURL']);
-            $this->jsFunction = $_SESSION['multipersonsearch'][$this->name]['jsFunction'];
-            $this->defaultSelectableUsersIDs = $_SESSION['multipersonsearch'][$this->name]['defaultSelectableUsersIDs'];
-            $this->defaultSelectedUsersIDs = $_SESSION['multipersonsearch'][$this->name]['defaultSelectedUsersIDs'];
-            $this->searchObject = unserialize($_SESSION['multipersonsearch'][$this->name]['searchObject']);
-            $this->navigationItem = $_SESSION['multipersonsearch'][$this->name]['navigationItem'];
-            $this->dataDialogStatus = $_SESSION['multipersonsearch'][$this->name]['dataDialogStatus'];
+            $this->title = $_SESSION['multipersonsearch'][$this->name]['title'] ?? '';
+            $this->description = $_SESSION['multipersonsearch'][$this->name]['description'] ?? '';
+            $this->quickfilterIds = $_SESSION['multipersonsearch'][$this->name]['quickfilterIds'] ?? [];
+            $this->additionalHMTL = $_SESSION['multipersonsearch'][$this->name]['additionalHMTL'] ?? '';
+            $this->executeURL = html_entity_decode($_SESSION['multipersonsearch'][$this->name]['executeURL'] ?? '');
+            $this->jsFunction = $_SESSION['multipersonsearch'][$this->name]['jsFunction'] ?? '';
+            $this->defaultSelectableUsersIDs = $_SESSION['multipersonsearch'][$this->name]['defaultSelectableUsersIDs'] ?? [];
+            $this->defaultSelectedUsersIDs = $_SESSION['multipersonsearch'][$this->name]['defaultSelectedUsersIDs'] ?? [];
+            $this->searchObject = unserialize($_SESSION['multipersonsearch'][$this->name]['searchObject'] ?? null);
+            $this->navigationItem = $_SESSION['multipersonsearch'][$this->name]['navigationItem'] ?? null;
+            $this->dataDialogStatus = $_SESSION['multipersonsearch'][$this->name]['dataDialogStatus'] ?? '';
         }
     }
 
diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php
index 0e839e88fee9f4c117dd90f77ff9911991c66377..84985e224a6de037a6287be54be51692bfeada57 100644
--- a/lib/classes/Seminar.class.php
+++ b/lib/classes/Seminar.class.php
@@ -333,6 +333,9 @@ class Seminar
                 $cycles[$id]['last_date'] = CycleDataDB::getLastDate($id);
                 if (!empty($cycles[$id]['assigned_rooms'])) {
                     foreach ($cycles[$id]['assigned_rooms'] as $room_id => $count) {
+                        if (!isset($rooms[$room_id])) {
+                            $rooms[$room_id] = 0;
+                        }
                         $rooms[$room_id] += $count;
                     }
                 }
diff --git a/lib/classes/TreeAbstract.class.php b/lib/classes/TreeAbstract.class.php
index dc9682073d6bf879de574a1d7fa0e3187c34cb0e..7cdb9404a6c3c6ca627e094005ed59d90bf3a701 100644
--- a/lib/classes/TreeAbstract.class.php
+++ b/lib/classes/TreeAbstract.class.php
@@ -203,7 +203,7 @@ class TreeAbstract {
     */
     public function getKids($item_id)
     {
-        return (is_array($this->tree_childs[$item_id])) ? $this->tree_childs[$item_id] : null;
+        return (isset($this->tree_childs[$item_id]) && is_array($this->tree_childs[$item_id])) ? $this->tree_childs[$item_id] : null;
     }
 
     /**
diff --git a/lib/classes/sidebar/RoomClipboardWidget.class.php b/lib/classes/sidebar/RoomClipboardWidget.class.php
index da5146a9cd505dc186041cc2cd08131b29528bbe..3d90c3680cae940fa27c4af9bd96fe8abfc7549a 100644
--- a/lib/classes/sidebar/RoomClipboardWidget.class.php
+++ b/lib/classes/sidebar/RoomClipboardWidget.class.php
@@ -14,7 +14,7 @@ class RoomClipboardWidget extends ClipboardWidget
     public function __construct()
     {
         parent::__construct(['Room']);
-
+        $this->allowed_item_class = '';
         $this->setTitle(_('Individuelle Raumgruppen'));
         $this->template = 'sidebar/room-clipboard-widget';
 
diff --git a/lib/classes/visibility/UserPrivacy.php b/lib/classes/visibility/UserPrivacy.php
index e521dc3ba6692f7e33202d19a62a51b13878cc34..1cfbcdaa907518696b4bee46f027910b03dcd9cf 100644
--- a/lib/classes/visibility/UserPrivacy.php
+++ b/lib/classes/visibility/UserPrivacy.php
@@ -71,7 +71,7 @@ class UserPrivacy
                             }
                         }
 
-                        $child = $idmap[$key] ?: new User_Visibility_Settings();
+                        $child = $idmap[$key] ?? new User_Visibility_Settings();
                         $child->setData([
                             'user_id'    => $this->user->id,
                             'parent_id'  => $vis->id,
diff --git a/lib/evaluation/classes/db/EvaluationObjectDB.class.php b/lib/evaluation/classes/db/EvaluationObjectDB.class.php
index 2af32a482e9095fa733160752b7922f3e0d5b447..1e8f66ff4168e35fac04a6d18f9c88b8873c19b8 100644
--- a/lib/evaluation/classes/db/EvaluationObjectDB.class.php
+++ b/lib/evaluation/classes/db/EvaluationObjectDB.class.php
@@ -200,7 +200,7 @@ class EvaluationObjectDB extends DatabaseObject
     {
         $no_permisson = 0;
         $rangeIDs = $eval->getRangeIDs();
-
+        $no_permisson_ranges = [];
         if (!is_array($rangeIDs)) {
             $rangeIDs = [$rangeIDs];
         }
diff --git a/lib/evaluation/evaluation_admin_overview.inc.php b/lib/evaluation/evaluation_admin_overview.inc.php
index 32b7a5fd49981de52550dfaefb3585daa8644b0f..d8ba9a31cb87709cdcc2142ac62314d5bbb942b9 100644
--- a/lib/evaluation/evaluation_admin_overview.inc.php
+++ b/lib/evaluation/evaluation_admin_overview.inc.php
@@ -51,7 +51,7 @@ define("DISCARD_OPENID", "discard_openid");
 
 /* Create objects ---------------------------------------------------------- */
 $db = new EvaluationObjectDB ();
-if ($db->isError) {
+if ($db->getErrors()) {
     return MessageBox::error(_("Datenbankfehler"));
 }
 $lib = new EvalOverview ($db, $GLOBALS['perm'], $GLOBALS['user']);
@@ -59,10 +59,10 @@ $lib = new EvalOverview ($db, $GLOBALS['perm'], $GLOBALS['user']);
 
 
 /* Set variables ----------------------------------------------------------- */
-if ($_SESSION['evalID'])  {
+if (isset($_SESSION['evalID']))  {
     unset($_SESSION['evalID']);
 }
-if ($_SESSION['rangeID']) {
+if (isset($_SESSION['rangeID'])) {
     unset($_SESSION['rangeID']);
 }
 
@@ -70,7 +70,7 @@ if (!empty($the_range)) {
     $rangeID = $the_range;
 }
 
-$rangeID = ($rangeID) ? $rangeID : Context::getId();
+$rangeID = $rangeID ?? Context::getId();
 
 if (empty ($rangeID) || ($rangeID == $GLOBALS['user']->username)) {
     $rangeID = $GLOBALS['user']->id;
@@ -101,9 +101,10 @@ if (!$GLOBALS['perm']->have_studip_perm("tutor", $rangeID) && $GLOBALS['user']->
     return;
 }
 
-$safeguard = $lib->callSafeguard($evalAction, $evalID, $rangeID, $search, $referer);
+$safeguard = $lib->callSafeguard($evalAction, $evalID, $rangeID, $search, null);
 /* ---------------------------------------------------------- end: safeguard */
 
+$foundTable = '';
 /* found public templates -------------------------------------------------- */
 if ($templates_search) {
     $search = trim($search);
diff --git a/lib/evaluation/evaluation_admin_overview.lib.php b/lib/evaluation/evaluation_admin_overview.lib.php
index b552a5fe163b632a72bf315904f8af0524e92b59..54f3f46f48480615ab10ad1282e9767af2f440df 100644
--- a/lib/evaluation/evaluation_admin_overview.lib.php
+++ b/lib/evaluation/evaluation_admin_overview.lib.php
@@ -2210,14 +2210,15 @@ class EvalOverview
      */
     function getPageCommand()
     {
-        if (Request::option("evalAction"))
-            return Request::option("evalAction");
-
+        if (Request::option('evalAction')) {
+            return Request::option('evalAction');
+        }
+        $command = [];
         foreach ($_REQUEST as $key => $value) {
             if (preg_match("/(.*)_button(_x)?/", $key, $command))
                 break;
         }
-        return $command[1];
+        return $command[1] ?? '';
     }
 
 # ===================================================== end: public functions #
diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php
index 05f6979e39206d1f521660170de034b1d455391e..412600fdd9f4a07826935298efe5a8d5683bc2fb 100644
--- a/lib/filesystem/StandardFile.php
+++ b/lib/filesystem/StandardFile.php
@@ -65,11 +65,11 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
 
         $fileref = new FileRef();
         $fileref['name']                    = $filename;
-        $fileref['description']             = $data['description'] ?: "";
+        $fileref['description']             = $data['description'] ?? "";
         $fileref['downloads']               = 0;
         $fileref['user_id']                 = $user_id;
         $fileref['file_id']                 = $file->getId();
-        $fileref['content_terms_of_use_id'] = $data['content_terms_of_use_id'] ?: ContentTermsOfUse::findDefault()->id;
+        $fileref['content_terms_of_use_id'] = $data['content_terms_of_use_id'] ?? ContentTermsOfUse::findDefault()->id;
 
         return new static($fileref, $file);
     }
diff --git a/lib/models/ToolActivation.php b/lib/models/ToolActivation.php
index 06ec25f4dc8b1dcf6c17a0722277c9abd216c611..422fb0f991d739ffbe302edf62a7ff3aec3b32f7 100644
--- a/lib/models/ToolActivation.php
+++ b/lib/models/ToolActivation.php
@@ -82,8 +82,7 @@ class ToolActivation extends SimpleORMap
         $module = $this->getStudipModule();
         if ($module) {
             $metadata = $module->getMetadata();
-            $name = $metadata['displayname'] ?: $module->getPluginName();
-            return $name;
+            return $metadata['displayname'] ?? $module->getPluginName();
         }
     }
 
diff --git a/lib/models/User.class.php b/lib/models/User.class.php
index 6011e6b791a92a843226d503d4e4750248a68a25..7ec24aa2cfb650e7d97bec3f1d5d640e8f19b91f 100644
--- a/lib/models/User.class.php
+++ b/lib/models/User.class.php
@@ -718,6 +718,8 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         // Non-private dates.
         if (Config::get()->CALENDAR_ENABLE) {
             $dates = CalendarEvent::countBySql('range_id = ?', [$this->id]);
+        } else {
+            $dates = [];
         }
 
         // Votes
@@ -737,7 +739,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if (Avatar::getAvatar($this->id)->is_customized() && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['picture'])) {
             $homepage_elements['picture'] = [
                 'name'        => _('Eigenes Bild'),
-                'visibility'  => $homepage_visibility['picture'] ?: get_default_homepage_visibility($this->id),
+                'visibility'  => $homepage_visibility['picture'] ?? get_default_homepage_visibility($this->id),
                 'extern'      => true,
                 'identifier'  => 'commondata'
             ];
@@ -746,7 +748,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if ($this->info->motto && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['motto'])) {
             $homepage_elements['motto'] = [
                 'name'       => _('Motto'),
-                'visibility' => $homepage_visibility['motto'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['motto']?? get_default_homepage_visibility($this->id),
                 'identifier' => 'privatedata'
             ];
         }
@@ -754,7 +756,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
             if ($GLOBALS['user']->cfg->getValue('SKYPE_NAME') && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['skype_name'])) {
                 $homepage_elements['skype_name'] = [
                     'name'       => _('Skype Name'),
-                    'visibility' => $homepage_visibility['skype_name'] ?: get_default_homepage_visibility($this->id),
+                    'visibility' => $homepage_visibility['skype_name']?? get_default_homepage_visibility($this->id),
                     'identifier' => 'privatedata'
                 ];
             }
@@ -762,28 +764,28 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if ($this->info->privatnr && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['Private Daten_phone'])) {
             $homepage_elements['private_phone'] = [
                 'name'       => _('Private Telefonnummer'),
-                'visibility' => $homepage_visibility['private_phone'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['private_phone']?? get_default_homepage_visibility($this->id),
                 'identifier' => 'privatedata'
             ];
         }
         if ($this->info->privatcell && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['private_cell'])) {
             $homepage_elements['private_cell'] = [
                 'name'       => _('Private Handynummer'),
-                'visibility' => $homepage_visibility['private_cell'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['private_cell']?? get_default_homepage_visibility($this->id),
                 'identifier' => 'privatedata'
             ];
         }
         if ($this->info->privadr && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['privadr'])) {
             $homepage_elements['privadr'] = [
                 'name'         => _('Private Adresse'),
-                'visibility'   => $homepage_visibility['privadr'] ?: get_default_homepage_visibility($this->id),
+                'visibility'   => $homepage_visibility['privadr']?? get_default_homepage_visibility($this->id),
                 'identifier'   => 'privatedata'
             ];
         }
         if ($this->info->home && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['homepage'])) {
             $homepage_elements['homepage'] = [
                 'name'        => _('Homepage-Adresse'),
-                'visibility'  => $homepage_visibility['homepage'] ?: get_default_homepage_visibility($this->id),
+                'visibility'  => $homepage_visibility['homepage']?? get_default_homepage_visibility($this->id),
                 'extern'      => true,
                 'identifier'  => 'privatedata'
             ];
@@ -791,7 +793,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if ($news && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['news'])) {
             $homepage_elements['news'] = [
                 'name'       => _('Ankündigungen'),
-                'visibility' => $homepage_visibility['news'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['news']?? get_default_homepage_visibility($this->id),
                 'extern'     => true,
                 'identifier' => 'commondata'
             ];
@@ -799,7 +801,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if (Config::get()->CALENDAR_ENABLE && $dates && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['dates'])) {
             $homepage_elements['termine'] = [
                 'name'       => _('Termine'),
-                'visibility' => $homepage_visibility['termine'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['termine']?? get_default_homepage_visibility($this->id),
                 'extern'     => true,
                 'identifier' => 'commondata'
             ];
@@ -807,7 +809,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
         if (Config::get()->VOTE_ENABLE && ($activeVotes || $stoppedVotes || $activeEvals) && empty($GLOBALS['NOT_HIDEABLE_FIELDS'][$this->perms]['votes'])) {
             $homepage_elements['votes'] = [
                 'name'       => _('Fragebögen'),
-                'visibility' => $homepage_visibility['votes'] ?: get_default_homepage_visibility($this->id),
+                'visibility' => $homepage_visibility['votes']?? get_default_homepage_visibility($this->id),
                 'identifier' => 'commondata'
             ];
         }
diff --git a/lib/seminar_open.php b/lib/seminar_open.php
index 3449f202eac81529e7af146c55db302355354fda..8d7d65e9089e4ff5a53fc9600d66435b08e69c8c 100644
--- a/lib/seminar_open.php
+++ b/lib/seminar_open.php
@@ -186,7 +186,7 @@ if (!Request::isXhr() && $perm->have_perm('root')) {
         $_SESSION['migration-check']['disabled'] = true;
     }
 
-    if (!$_SESSION['migration-check']['disabled']
+    if (!empty($_SESSION['migration-check']['disabled'])
         && $_SESSION['migration-check']['count'] > 0
     ) {
         $info = sprintf(
diff --git a/public/sendfile.php b/public/sendfile.php
index 77cc7353a3b38ba8f69545da0c2bcb6e4ccf1dd2..0c6391aed18a052ede64c465ebeaf7f5a72eaac8 100644
--- a/public/sendfile.php
+++ b/public/sendfile.php
@@ -175,7 +175,7 @@ while (ob_get_level()) {
     ob_end_clean();
 }
 
-if (isset($file_ref, $file_ref->file) && $file_ref->file->metadata['access_type'] === 'redirect') {
+if (isset($file_ref, $file_ref->file, $file_ref->file->metadata['access_type']) && $file_ref->file->metadata['access_type'] === 'redirect') {
     $file_ref->incrementDownloadCounter();
     header('Location: ' . $file_ref->file->metadata['url']);
     die();
diff --git a/templates/dates/seminar_html.php b/templates/dates/seminar_html.php
index 515d9f89624654aef3ec588fd0fa483c9a9cb693..1f55dbfbbb452ac4f94fd54c1c601de07cb3ca12 100644
--- a/templates/dates/seminar_html.php
+++ b/templates/dates/seminar_html.php
@@ -45,7 +45,7 @@ if (!$dates['regular']['turnus_data'] && empty($dates['irregular'])) {
     $freetext_rooms = [];
     $irregular_rooms = [];
 
-    if (is_array($dates['irregular'])) {
+    if (isset($dates['irregular']) && is_array($dates['irregular'])) {
         foreach ($dates['irregular'] as $date) {
             if (!isset($irregular_rooms[$date['resource_id']])) {
                 $irregular_rooms[$date['resource_id']] = 0;