Fix PHP warning when 1st argument of parse_host() is not a string (#1489486)
| | |
| | | */ |
| | | 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 |
| | |
| | | } |
| | | } |
| | | |
| | | $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); |
| | | } |
| | | |
| | | |