diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-12-20 17:41:10 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-12-20 17:41:10 +0100 |
commit | f6d23a8dce6258f954257174bc03f2b85a21afdf (patch) | |
tree | 81243837eb5dbaf60bddad9961ef73438fc4646b /program/lib/Roundcube/rcube_utils.php | |
parent | c562a316817091b80ac9c7d3efa31067850b03e6 (diff) |
Fix PHP warning when 1st argument of parse_host() is not a string (#1489486)
Diffstat (limited to 'program/lib/Roundcube/rcube_utils.php')
-rw-r--r-- | program/lib/Roundcube/rcube_utils.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php index fb5a8100d..c48cd80e8 100644 --- a/program/lib/Roundcube/rcube_utils.php +++ b/program/lib/Roundcube/rcube_utils.php @@ -622,6 +622,10 @@ class rcube_utils */ public static function parse_host($name, $host = '') { + if (!is_string($name)) { + return $name; + } + // %n - host $n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']); // %t - host name without first part, e.g. %n=mail.domain.tld, %t=domain.tld @@ -642,8 +646,7 @@ class rcube_utils } } - $name = str_replace(array('%n', '%t', '%d', '%h', '%z', '%s'), array($n, $t, $d, $h, $z, $s[2]), $name); - return $name; + return str_replace(array('%n', '%t', '%d', '%h', '%z', '%s'), array($n, $t, $d, $h, $z, $s[2]), $name); } |