diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php
index beef3fd1670959a15ecd080021fb082b0f883c59..0a26f301bf2dcf48eaba2a4a3b16c55a0b56debd 100644
--- a/lib/SimpleSAML/Utils/HTTP.php
+++ b/lib/SimpleSAML/Utils/HTTP.php
@@ -101,14 +101,14 @@ class HTTP
         $port = (isset($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : '80';
         if (self::getServerHTTPS()) {
             if ($port !== '443') {
-                $port = ':'.$port;
+                return ':'.$port;
             }
         } else {
             if ($port !== '80') {
-                $port = ':'.$port;
+                return ':'.$port;
             }
         }
-        return $port;
+        return '';
     }