diff --git a/app/controllers/course/timesrooms.php b/app/controllers/course/timesrooms.php
index f452f4d01696e3e0d65fd0a8db2bc255831f1b72..4788eee05e098b7254a3635366212b7f1c39b0a2 100644
--- a/app/controllers/course/timesrooms.php
+++ b/app/controllers/course/timesrooms.php
@@ -516,7 +516,7 @@ class Course_TimesroomsController extends AuthenticatedController
                 '<strong>' . htmlReady($singledate->toString()) . '</strong>'
             ));
         }
-        if ($singledate->messages['error']) {
+        if (!empty($singledate->messages['error'])) {
             PageLayout::postError(
                 _('Die folgenden Fehler traten beim Bearbeiten des Termins auf:'),
                 htmlReady($singledate->messages['error'])
@@ -1687,7 +1687,7 @@ class Course_TimesroomsController extends AuthenticatedController
             } else {
                 $user_rooms = RoomManager::getUserRooms($current_user);
                 foreach ($user_rooms as $room) {
-                    if ($room->userHasBookingRights($current_user, $begin, $end)) {
+                    if ($room->userHasBookingRights($current_user, $begin ?? null, $end ?? null)) {
                         $rooms_with_booking_permissions++;
                         if ($only_bookable_rooms) {
                             foreach ($all_time_intervals as $interval) {
diff --git a/app/controllers/profile.php b/app/controllers/profile.php
index 72a500e20d2f4f7b6e6100fa09c68d4ed78953dc..1412c9cd591a8ad852199bc97d20c49e40f4e63b 100644
--- a/app/controllers/profile.php
+++ b/app/controllers/profile.php
@@ -40,14 +40,14 @@ class ProfileController extends AuthenticatedController
 
         // set the page title depending on user selection
         if (
-            $this->user
+            isset($this->user, $this->current_user)
             && $this->current_user->id === $this->user->id
             && !$this->current_user->locked
         ) {
             PageLayout::setTitle(_('Mein Profil'));
             UserConfig::get($this->user->id)->store('PROFILE_LAST_VISIT', time());
         } elseif (
-            $this->current_user->id
+            !empty($this->current_user->id)
             && (
                 $this->perm->have_perm('root')
                 || (
@@ -139,17 +139,16 @@ class ProfileController extends AuthenticatedController
         }
 
         // calendar
-        $this->dates = '';
-        if (Config::get()->CALENDAR_ENABLE) {
-            if (!in_array($this->current_user->perms, ['admin', 'root'])) {
-                if (Visibility::verify('termine', $this->current_user->user_id)) {
-                    $start = time();
-                    $end   = strtotime('+1 week 23:59:59');
-
-                    $response    = $this->relay('calendar/contentbox/display/' . $this->current_user->user_id . '/' . ($end - $start));
-                    $this->dates = $response->body;
-                }
-            }
+        if (
+            Config::get()->CALENDAR_ENABLE
+            && !in_array($this->current_user->perms, ['admin', 'root'])
+            && Visibility::verify('termine', $this->current_user->user_id)
+        ) {
+            $start = time();
+            $end   = strtotime('+1 week 23:59:59');
+
+            $response    = $this->relay('calendar/contentbox/display/' . $this->current_user->user_id . '/' . ($end - $start));
+            $this->dates = $response->body;
         }
 
         // include and show votes and tests
diff --git a/app/views/profile/index.php b/app/views/profile/index.php
index b1911513eb9eabcc0ecc14c3c8f1d487a9cfb051..9b7cb4f5b20c64f8aa4660302604b2fd0a3f5663 100644
--- a/app/views/profile/index.php
+++ b/app/views/profile/index.php
@@ -83,9 +83,9 @@
 
 </section>
 
-<?= $news ?>
+<?= $news ?? '' ?>
 
-<?= $dates ?>
+<?= $dates ?? '' ?>
 
 <?= $questionnaires ?? '' ?>
 
diff --git a/lib/activities/Context.php b/lib/activities/Context.php
index 170552872662ad8caf3b46c927b2d5b67007fe9c..dba0d0f9eb62c31145a6a1ae0760b9d58099a661 100644
--- a/lib/activities/Context.php
+++ b/lib/activities/Context.php
@@ -147,7 +147,7 @@ abstract class Context
         } else {
             foreach ($providers as $provider) {
                 $ctype = $this->getContextType();
-                $filtered_classes = $filter->getType()->$ctype;
+                $filtered_classes = $filter->getType()->$ctype ?? null;
 
                 if (is_array($filtered_classes)) {
                     foreach ($filtered_classes as $class) {
diff --git a/lib/filesystem/CourseGroupFolder.php b/lib/filesystem/CourseGroupFolder.php
index 81867f6649142a56474db9f2a47a2d2449f190ce..36bbb922a84bd22fd7f3d36ab6b35fe9b89acc69 100644
--- a/lib/filesystem/CourseGroupFolder.php
+++ b/lib/filesystem/CourseGroupFolder.php
@@ -123,7 +123,7 @@ class CourseGroupFolder extends StandardFolder
     public function getEditTemplate()
     {
         $template = $GLOBALS['template_factory']->open('filesystem/group_folder/edit.php');
-        $group = Statusgruppen::find($this->folderdata['data_content']['group']);
+        $group = Statusgruppen::find($this->folderdata['data_content']['group'] ?? null);
         $template->set_attribute('group', $group);
         $template->set_attribute('folder', $this);
         return $template;
@@ -151,7 +151,7 @@ class CourseGroupFolder extends StandardFolder
      */
     public function getDescriptionTemplate()
     {
-        $group = new Statusgruppen($this->folderdata['data_content']['group']);
+        $group = new Statusgruppen($this->folderdata['data_content']['group'] ?? null);
 
         $template = $GLOBALS['template_factory']->open('filesystem/group_folder/description.php');
         $template->type       = self::getTypeName();
diff --git a/templates/layouts/dialog.php b/templates/layouts/dialog.php
index ddf9280eed0d0ccf577563fe4a4d23b709c98776..147f69d7579b7fed4b11da4f20b2cfa0281b0673 100644
--- a/templates/layouts/dialog.php
+++ b/templates/layouts/dialog.php
@@ -1,2 +1,2 @@
-<?= implode(PageLayout::getMessages()) ?>
-<?= $content_for_layout ?>
\ No newline at end of file
+<?= implode('', PageLayout::getMessages()) ?>
+<?= $content_for_layout ?>