From f6d23a8dce6258f954257174bc03f2b85a21afdf Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 20 Dec 2013 17:41:10 +0100 Subject: Fix PHP warning when 1st argument of parse_host() is not a string (#1489486) --- program/lib/Roundcube/rcube_utils.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'program/lib/Roundcube') 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); } -- cgit v1.2.3