From be6111f3d76c58f2da2cd1d29948caae0118da71 Mon Sep 17 00:00:00 2001
From: David Siegfried <david.siegfried@uni-vechta.de>
Date: Mon, 11 Sep 2023 13:01:02 +0000
Subject: [PATCH] prevent php8-warnings, closes #3170

Closes #3170

Merge request studip/studip!2147
---
 app/controllers/course/enrolment.php   | 3 ++-
 app/views/course/enrolment/apply.php   | 2 +-
 app/views/my_courses/_exportcourse.php | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/app/controllers/course/enrolment.php b/app/controllers/course/enrolment.php
index a9ca3516bf6..275620d3dda 100644
--- a/app/controllers/course/enrolment.php
+++ b/app/controllers/course/enrolment.php
@@ -74,7 +74,8 @@ class Course_EnrolmentController extends AuthenticatedController
             $this->relocate(URLHelper::getLink('dispatch.php/course/details', ['sem_id' => $this->course_id]));
             return;
         }
-
+        $this->admission_error = '';
+        $this->admission_form = '';
         $this->course = Course::find($this->course_id);
 
         try {
diff --git a/app/views/course/enrolment/apply.php b/app/views/course/enrolment/apply.php
index 54a1ff35f7b..531a5525b03 100644
--- a/app/views/course/enrolment/apply.php
+++ b/app/views/course/enrolment/apply.php
@@ -17,7 +17,7 @@
         </div>
         <?= CSRFProtection::tokenTag() ?>
     </form>
-<? elseif ($priocourses): ?>
+<? elseif (!empty($priocourses)): ?>
     <form name="claim_admission" action="<?= $controller->action_link("claim/{$course_id}") ?>" method="post" class="default">
     <? if (is_array($priocourses)): ?>
         <?= $this->render_partial('course/enrolment/_priocourses.php') ?>
diff --git a/app/views/my_courses/_exportcourse.php b/app/views/my_courses/_exportcourse.php
index b198fd21a80..cfd0815b330 100644
--- a/app/views/my_courses/_exportcourse.php
+++ b/app/views/my_courses/_exportcourse.php
@@ -44,7 +44,7 @@
 <th><?= _('Name') ?></th>
 <td><?= htmlReady($course['name']) ?></td>
 </tr>
-<? if ($course['untertitel']): ?>
+<? if (!empty($course['untertitel'])): ?>
 <tr>
 <th><?= _('Untertitel') ?></th>
 <td><?= htmlReady($course['untertitel']) ?></td>
@@ -77,7 +77,7 @@
 </table>
 <br><br>
 
-<? if ($course['children']) : ?>
+<? if (!empty($course['children'])) : ?>
     <?= $this->render_partial('my_courses/_exportcourse', [
         'course_collection' => $course['children'],
         'children'          => true,
-- 
GitLab