diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 9182347d7f4909e1f18929037e9cc15c37708203..eccd8e523e8bbf6204a67cbe8b0fc34f06855ef0 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -609,7 +609,7 @@ class Net_LDAP3
         $port  = $this->config_get('port', 389);
 
         foreach ((array) $hosts as $host) {
-            $this->_debug("C: Connect [$host:$port]");
+            $this->_debug("C: Connect [" . $host . (strpos($host, ':') ? '' : ":$port") . "]");
 
             if ($lc = @ldap_connect($host, $port)) {
                 if ($this->config_get('use_tls', false) === true) {