diff --git a/include/login/class_LoginMethod.inc b/include/login/class_LoginMethod.inc
index a4e1b3b0f5a59fc85f9ddff716318a55307cd6c7..9ea359ef1b4b8a799e19b7a093b0c9ac70610fdf 100755
--- a/include/login/class_LoginMethod.inc
+++ b/include/login/class_LoginMethod.inc
@@ -85,11 +85,11 @@ class LoginMethod
   static function validateUserInput (): bool
   {
     global $message, $smarty;
-    static::$username = trim(static::$username);
+    static::$username = trim((string) static::$username);
     if (!preg_match('/^[@A-Za-z0-9_.-]+$/', static::$username)) {
       $message = _('Please specify a valid username!');
       return FALSE;
-    } elseif (mb_strlen(static::$password, 'UTF-8') == 0) {
+    } elseif (mb_strlen((string) static::$password, 'UTF-8') == 0) {
       $message = _('Please specify your password!');
       $smarty->assign('focusfield', 'password');
       return FALSE;
@@ -170,7 +170,7 @@ class LoginMethod
   }
 
   /*! \brief Final step of successful login: redirect to main.php */
-  static function redirect ()
+  static function redirect (): never
   {
     static::connect();
     header('Location: main.php');
diff --git a/include/login/class_LoginPost.inc b/include/login/class_LoginPost.inc
index bc18fe38d9bf818d1ea320bc146d22b621e0d171..bb4f50d0ce7e5684bcaacc98b7a9676cb2fe5663 100755
--- a/include/login/class_LoginPost.inc
+++ b/include/login/class_LoginPost.inc
@@ -107,7 +107,7 @@ class LoginPost extends LoginMethod
     /* Fill template with required values */
     $username = '';
     if (isset($_POST['username'])) {
-      $username = trim($_POST['username']);
+      $username = trim((string) $_POST['username']);
     }
     $smarty->assign('date',       gmdate('D, d M Y H:i:s'));
     $smarty->assign('username',   $username);
@@ -150,7 +150,7 @@ class LoginPost extends LoginMethod
     /* show login screen */
     $smarty->assign('PHPSESSID', session_id());
     if ($error_collector != '') {
-      $smarty->assign('php_errors', preg_replace('/%BUGBODY%/', $error_collector_mailto, $error_collector).'</div>');
+      $smarty->assign('php_errors', preg_replace('/%BUGBODY%/', (string) $error_collector_mailto, (string) $error_collector).'</div>');
     } else {
       $smarty->assign('php_errors', '');
     }
@@ -179,7 +179,7 @@ class LoginPost extends LoginMethod
     /* Fill template with required values */
     $username = '';
     if (isset($_POST['username'])) {
-      $username = trim($_POST['username']);
+      $username = trim((string) $_POST['username']);
     }
     $smarty->assign('date',       gmdate('D, d M Y H:i:s'));
     $smarty->assign('username',   $username);
@@ -196,7 +196,7 @@ class LoginPost extends LoginMethod
     /* show login screen */
     $smarty->assign('PHPSESSID', session_id());
     if ($error_collector != '') {
-      $smarty->assign('php_errors', preg_replace('/%BUGBODY%/', $error_collector_mailto, $error_collector).'</div>');
+      $smarty->assign('php_errors', preg_replace('/%BUGBODY%/', (string) $error_collector_mailto, (string) $error_collector).'</div>');
     } else {
       $smarty->assign('php_errors', '');
     }