Add fix for IPv6 literals in multiple host strings, see #1094

This commit is contained in:
Marcus Bointon 2017-07-26 22:52:29 +02:00
parent cb2be11013
commit 4f6449ecfa
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
1 changed files with 6 additions and 1 deletions

View File

@ -1622,8 +1622,13 @@ class PHPMailer
foreach ($hosts as $hostentry) {
$hostinfo = array();
if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9:\[\]\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
if (!preg_match(
'/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*|\[[a-fA-F0-9:]+\]):?([0-9]*)$/',
trim($hostentry),
$hostinfo
)) {
// Not a valid host entry
$this->edebug('Ignoring invalid host: ' . $hostentry);
continue;
}
// $hostinfo[2]: optional ssl or tls prefix