diff --git a/app/controllers/course/forum/index.php b/app/controllers/course/forum/index.php
index 01d60c0cd0c029c2d0f55625cbcf6c9ad6876a36..9be214ea3a8f95adbcf68132a40cb19007ddfd17 100644
--- a/app/controllers/course/forum/index.php
+++ b/app/controllers/course/forum/index.php
@@ -316,8 +316,8 @@ class Course_Forum_IndexController extends ForumController
             $list = ForumEntry::getSearchResults($this->getId(), $this->searchfor, $this->options);
 
             $this->postings          = $list['list'];
-            $this->number_of_entries = $list['count'];
-            $this->highlight         = $list['highlight'];
+            $this->number_of_entries = $list['count'] ?? 0;
+            $this->highlight         = $list['highlight'] ?? false;
 
             if (empty($this->postings)) {
                 $this->flash['messages'] = ['info' => _('Es wurden keine Beiträge gefunden, die zu Ihren Suchkriterien passen!')];
diff --git a/app/controllers/course/ilias_interface.php b/app/controllers/course/ilias_interface.php
index 0786944f208488371e7a21ac152ff4eff6e9aa69..4f453972ca7ee00915d2104037083aee016b70f1 100644
--- a/app/controllers/course/ilias_interface.php
+++ b/app/controllers/course/ilias_interface.php
@@ -47,8 +47,8 @@ class Course_IliasInterfaceController extends AuthenticatedController
         $this->seminar_id = Context::getId();
         $this->edit_permission = $GLOBALS['perm']->have_studip_perm('tutor', $this->seminar_id);
         $this->author_permission = false;
-        $this->change_course_permission = $GLOBALS['auth']->auth["perm"] == "root" || ($GLOBALS['perm']->have_studip_perm('tutor', $this->seminar_id) && $this->ilias_interface_config['allow_change_course']);
-        $this->add_own_course_permission = $GLOBALS['perm']->have_studip_perm('tutor', $this->seminar_id) && $this->ilias_interface_config['allow_add_own_course'];
+        $this->change_course_permission = $GLOBALS['auth']->auth["perm"] == "root" || ($GLOBALS['perm']->have_studip_perm('tutor', $this->seminar_id) && !empty($this->ilias_interface_config['allow_change_course']));
+        $this->add_own_course_permission = $GLOBALS['perm']->have_studip_perm('tutor', $this->seminar_id) && !empty($this->ilias_interface_config['allow_add_own_course']);
         $this->course_permission = $GLOBALS['perm']->have_studip_perm('tutor', $this->seminar_id);
 
         $this->sidebar = Sidebar::get();
@@ -166,7 +166,7 @@ class Course_IliasInterfaceController extends AuthenticatedController
 
         if ($this->author_permission || $this->edit_permission) {
             $widget = new ActionsWidget();
-            if ($this->edit_permission && $this->ilias_interface_config['add_statusgroups']) {
+            if ($this->edit_permission && !empty($this->ilias_interface_config['add_statusgroups'])) {
                 $widget->addLink(
                     _('Gruppen übertragen'),
                     $this->url_for('course/ilias_interface/add_groups'),
@@ -180,7 +180,7 @@ class Course_IliasInterfaceController extends AuthenticatedController
                     Icon::create('person')
                 );
             }
-            if ($this->edit_permission && $this->ilias_interface_config['edit_moduletitle']) {
+            if ($this->edit_permission && !empty($this->ilias_interface_config['edit_moduletitle'])) {
                 $widget->addLink(
                     _('Seite umbenennen'),
                     $this->url_for('course/ilias_interface/edit_moduletitle'),
diff --git a/app/controllers/course/members.php b/app/controllers/course/members.php
index 91601d760d559092d96657b596bc94265b0c1354..bcbea42046bf1dbea4a4c5b80d6eeb2468980b48 100644
--- a/app/controllers/course/members.php
+++ b/app/controllers/course/members.php
@@ -1496,6 +1496,9 @@ class Course_MembersController extends AuthenticatedController
     private function getUserVisibility()
     {
         $member = CourseMember::find([$this->course_id, $this->user_id]);
+        if (!$member) {
+            return ['iam_visible' => false, 'visible_mode' => false];
+        }
 
         $visibility = $member->visible;
         $status = $member->status;
diff --git a/app/controllers/new_password.php b/app/controllers/new_password.php
index 8b385683bb6db58f441a918e52ceaa9cee63e6c2..956bc5cd6d647a50991ea4e2a60c371c65c96c5b 100644
--- a/app/controllers/new_password.php
+++ b/app/controllers/new_password.php
@@ -69,7 +69,7 @@ class NewPasswordController extends StudipController
             restoreLanguage();
         }
 
-        if ($user) {
+        if (isset($user)) {
             // spam/abuse-protection
             // if there are more than 5 tokens present, do NOT send another mail
 
diff --git a/app/controllers/oer/market.php b/app/controllers/oer/market.php
index 69030c2e93ffbad6ab31132f8d0ee2490a5aa5df..0c12bffa113025ad06591146c2a9f8c4049a924b 100644
--- a/app/controllers/oer/market.php
+++ b/app/controllers/oer/market.php
@@ -414,7 +414,7 @@ class Oer_MarketController extends StudipController
             });
 
             if (Request::get('class') || count($this->classes) === 1) {
-                $class = Request::get('class') ?: $this->classes[0];
+                $class = Request::get('class') ?? $this->classes[0] ?? '';
                 if (class_exists($class) && in_array($class, $this->classes)) {
                     $response = $class::oerModuleIntegrateMaterialToCourse(
                         $this->material,
diff --git a/app/views/calendar/date/_add_edit_form.php b/app/views/calendar/date/_add_edit_form.php
index bf4b5897eedadb288e4a8f7a244c55a2f3f02289..08f379011c04f9e61cc5d5684feef0204840f105 100644
--- a/app/views/calendar/date/_add_edit_form.php
+++ b/app/views/calendar/date/_add_edit_form.php
@@ -134,7 +134,7 @@
         <legend><?= _('Ausnahmen') ?></legend>
         <date-list-input name="exceptions" :selected_dates="<?= htmlReady(json_encode($exceptions)) ?>"></date-list-input>
     </fieldset>
-    <? if (Config::get()->CALENDAR_GROUP_ENABLE && $user_quick_search_type) : ?>
+    <? if (Config::get()->CALENDAR_GROUP_ENABLE && isset($user_quick_search_type)) : ?>
         <fieldset class="simplevue">
             <legend><?= _('Teilnehmende Personen') ?></legend>
             <editable-list
diff --git a/app/views/file/add_from_library.php b/app/views/file/add_from_library.php
index 12291dac84838177f6a668724674d11209da6ad4..2f1ad54b64c58e0f8a9b621816b804025655623c 100644
--- a/app/views/file/add_from_library.php
+++ b/app/views/file/add_from_library.php
@@ -1,4 +1,4 @@
-<? if ($search_id && !$result_set) : ?>
+<? if (!empty($search_id) && empty($result_set)) : ?>
     <? if ($library_plugins) : ?>
         <?= MessageBox::info(_('Zu Ihrer Suche wurden keine Ergebnisse gefunden! Sie können ihre letzte Suchanfrage mit einer Mitteilung an die Bibliothek zur Klärung und Anfrage von Unterstützung senden.')) ?>
     <? else : ?>
@@ -17,29 +17,29 @@
             <div class="column">
                 <label>
                     <?= _('Titel') ?>
-                    <input type="text" name="title" value="<?= htmlReady($title) ?>">
+                    <input type="text" name="title" value="<?= htmlReady($title ?? '') ?>">
                 </label>
                 <label>
                     <?= _('Autor') ?>
-                    <input type="text" name="author" value="<?= htmlReady($author) ?>">
+                    <input type="text" name="author" value="<?= htmlReady($author ?? '') ?>">
                 </label>
                 <label>
                     <?= _('Jahr') ?>
-                    <input type="text" name="year" value="<?= htmlReady($year) ?>">
+                    <input type="text" name="year" value="<?= htmlReady($year ?? '') ?>">
                 </label>
             </div>
             <div class="column">
                 <label>
                     <?= _('Nummer (ISBN/ISSN/...)') ?>
-                    <input type="text" name="number" value="<?= htmlReady($number) ?>">
+                    <input type="text" name="number" value="<?= htmlReady($number ?? '') ?>">
                 </label>
                 <label>
                     <?= _('Zeitschrift') ?>
-                    <input type="text" name="publication" value="<?= htmlReady($publication) ?>">
+                    <input type="text" name="publication" value="<?= htmlReady($publication ?? '') ?>">
                 </label>
                 <label>
                     <?= _('Signatur') ?>
-                    <input type="text" name="signature" value="<?= htmlReady($signature) ?>">
+                    <input type="text" name="signature" value="<?= htmlReady($signature ?? '') ?>">
                 </label>
             </div>
         </div>
@@ -60,8 +60,8 @@
         </div>
     </fieldset>
 </form>
-<? if ($result_set): ?>
-    <? $last_result_number = (($page + 1) * $page_size);
+<? if (!empty($result_set)): ?>
+    <? $last_result_number = ($page + 1) * $page_size;
     if ($last_result_number > $total_results) {
         $last_result_number = $total_results;
     }
@@ -154,7 +154,7 @@
         </div>
     </form>
 <? endif ?>
-<? if ($library_plugins) : ?>
+<? if (!empty($library_plugins)) : ?>
     <section class="big-help-box">
         <?= Icon::create('support')->asImg(96, ['class' => 'icon']) ?>
         <div class="text">
diff --git a/lib/classes/JsonApi/Routes/Tree/CourseInfoOfTreeNode.php b/lib/classes/JsonApi/Routes/Tree/CourseInfoOfTreeNode.php
index 086b25265c510bbd3bffb7b3353628d73e25ab9b..4e2f61d340aa8f62d6c5c172b71b31aad9ee8885 100644
--- a/lib/classes/JsonApi/Routes/Tree/CourseInfoOfTreeNode.php
+++ b/lib/classes/JsonApi/Routes/Tree/CourseInfoOfTreeNode.php
@@ -42,7 +42,7 @@ class CourseInfoOfTreeNode extends NonJsonApiController
 
     private function validateFilters($request)
     {
-        $filtering = $request->getQueryParams()['filter'] ?: [];
+        $filtering = $request->getQueryParams()['filter'] ?? [];
 
         // keyword aka q
         if (isset($filtering['q']) && mb_strlen($filtering['q']) < 3) {
@@ -75,7 +75,7 @@ class CourseInfoOfTreeNode extends NonJsonApiController
             'recursive' => false
         ];
 
-        $filtering = $request->getQueryParams()['filter'] ?: [];
+        $filtering = $request->getQueryParams()['filter'] ?? [];
 
         return array_merge($defaults, $filtering);
     }
diff --git a/lib/classes/PluginAdministration.php b/lib/classes/PluginAdministration.php
index faba3ecc9a32c4289ae570640a783a74af550f47..747d74e819a8d94650e80cb9da78943969492028 100644
--- a/lib/classes/PluginAdministration.php
+++ b/lib/classes/PluginAdministration.php
@@ -465,7 +465,7 @@ class PluginAdministration
         $pluginid = $plugin_manager->registerPlugin($manifest['pluginname'], $pluginclass, $pluginpath);
 
         // register additional plugin classes in this package
-        $additionalclasses = $manifest['additionalclasses'];
+        $additionalclasses = $manifest['additionalclasses'] ?? null;
 
         if (is_array($additionalclasses)) {
             foreach ($additionalclasses as $class) {
diff --git a/lib/classes/StudipCoreFormat.php b/lib/classes/StudipCoreFormat.php
index 718d10f96215b58349adfd81ecd09d66ba01571c..bc3ded3096b9f767c1bb9530f13430acee6c7f93 100644
--- a/lib/classes/StudipCoreFormat.php
+++ b/lib/classes/StudipCoreFormat.php
@@ -566,7 +566,8 @@ class StudipCoreFormat extends TextFormat
 
         $intern = false;
         if (
-            in_array($pu['scheme'], ['http', 'https'])
+            isset($pu['scheme'])
+            && in_array($pu['scheme'], ['http', 'https'])
             && isset($_SERVER['HTTP_HOST'])
             && (
                 !isset($pu['host'])
diff --git a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
index a901b6cdec4e61730ea9e952659cf09888b85f32..6fae1dfee3e75e5053c87a5257fd54b9405205c9 100644
--- a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
+++ b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php
@@ -494,8 +494,8 @@ class LVGroupsWizardStep implements CourseWizardStep
 
         // the id of the home institute
         // get the institute from the first step (normally "BasicDataWizardStep")
-        $inst_id = reset($values)['institute'];
-        if ($access_right == 'fakadmin') {
+        $inst_id = reset($values)['institute'] ?? null;
+        if ($access_right === 'fakadmin') {
             // is fakadmin at faculty of given home institute
             $db = DBManager::get();
             $st = $db->prepare("SELECT a.Institut_id FROM user_inst a
@@ -504,7 +504,7 @@ class LVGroupsWizardStep implements CourseWizardStep
                 WHERE a.user_id = ? AND a.inst_perms='admin' AND NOT ISNULL(b.Institut_id)
                 AND c.Institut_id = ? LIMIT 1");
             $st->execute([$GLOBALS['user']->id, $inst_id]);
-            return !((bool) $st->fetchColumn());
+            return !$st->fetchColumn();
         }
         return !$perm->have_studip_perm($access_right, $inst_id);
 
diff --git a/lib/classes/forms/FileInput.php b/lib/classes/forms/FileInput.php
index 5862b3c8788d2714f0df4f1e02c52b215abb865b..1822314a828ece2fc0de7049d5eb747c446be5d7 100644
--- a/lib/classes/forms/FileInput.php
+++ b/lib/classes/forms/FileInput.php
@@ -13,9 +13,9 @@ class FileInput extends Input
         $template->folder = $this->value;
         $template->id = md5(uniqid());
         $template->uploadUrl = $this->attributes['upload_url'];
-        $template->multiple = $this->attributes['multiple'] ?? '';
+        $template->multiple = $this->attributes['multiple'] ?? false;
         $template->accept = $this->attributes['accept'] ?? '*/*';
-        $template->required = $this->attributes['required'] ?? '';
+        $template->required = $this->attributes['required'] ?? false;
 
         return $template->render();
     }
diff --git a/lib/visual.inc.php b/lib/visual.inc.php
index 751663f46dc4d243c6e41f932f29e8b273358f96..a6f052ae3efe8e5b2858fcf5da6406266008f052 100644
--- a/lib/visual.inc.php
+++ b/lib/visual.inc.php
@@ -416,7 +416,7 @@ function tooltip2($text, $with_alt = TRUE, $with_popup = FALSE) {
  * @param bool $important render icon in "important" style
  * @param bool $html tooltip text is HTML content
  */
-function tooltipIcon($text, $important = false, $html = false, bool $alt_info= false): string
+function tooltipIcon(string $text, bool $important = false, bool $html = false, bool $alt_info= false): string
 {
     if (!trim($text)) {
         return '';
@@ -433,12 +433,9 @@ function tooltipIcon($text, $important = false, $html = false, bool $alt_info= f
  * @param string $text tooltip text, html is rendered as is
  * @param bool $important render icon in "important" style
  */
-function tooltipHtmlIcon($text, $important = false)
+function tooltipHtmlIcon(string $text, bool $important = false)
 {
-    // render tooltip
-    $html = true;
-    $template = $GLOBALS['template_factory']->open('shared/tooltip');
-    return $template->render(compact('text', 'important', 'html'));
+    return tooltipIcon($text, true, $important);
 }
 
 /**
diff --git a/templates/forms/file_input.php b/templates/forms/file_input.php
index 2441b522cdfd395279457a1464fa5b72936f67e9..b987b925bab5151f153915a5b98e19c3f6047f6c 100644
--- a/templates/forms/file_input.php
+++ b/templates/forms/file_input.php
@@ -1,9 +1,21 @@
+<?php
+/**
+ * @var string $title
+ * @var string $name
+ * @var string $folder
+ * @var string $id
+ * @var string $uploadUrl
+ * @var bool $multiple
+ * @var string $accept
+ * @var bool $required
+ */
+?>
 <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
     <file-upload
         name="<?= htmlReady($name) ?>"
         title="<?= htmlReady($title) ?>"
         upload-url="<?= htmlReady($uploadUrl) ?>"
-        folder="<?= htmlReady($value) ?>"
+        folder="<?= htmlReady($folder) ?>"
         id="<?= htmlReady($id) ?>"
         :multiple="<?= $multiple ? 'true' : 'false' ?>"
         accept="<?= htmlReady($accept) ?>"