Handle MS Exchange returning invalid empty AUTH type list, fixes #462

This commit is contained in:
Synchro 2015-08-01 12:05:59 +02:00
parent 0639590054
commit 41d7273f87
2 changed files with 16 additions and 4 deletions

View File

@ -5,6 +5,7 @@
* Add address parser for RFC822-format addresses
* Update MS Office MIME types
* Don't convert line breaks when using quoted-printable encoding
* Handle MS Exchange returning an invalid empty AUTH-type list in EHLO
## Version 5.2.10 (May 4th 2015)
* Add custom header getter

View File

@ -723,9 +723,11 @@ class SMTP
{
$this->server_caps = array();
$lines = explode("\n", $this->last_reply);
foreach ($lines as $n => $s) {
//First 4 chars contain response code followed by - or space
$s = trim(substr($s, 4));
if (!$s) {
if (empty($s)) {
continue;
}
$fields = explode(' ', $s);
@ -735,11 +737,20 @@ class SMTP
$fields = $fields[0];
} else {
$name = array_shift($fields);
if ($name == 'SIZE') {
$fields = ($fields) ? $fields[0] : 0;
switch ($name) {
case 'SIZE':
$fields = ($fields ? $fields[0] : 0);
break;
case 'AUTH':
if (!is_array($fields)) {
$fields = array();
}
break;
default:
$fields = true;
}
}
$this->server_caps[$name] = ($fields ? $fields : true);
$this->server_caps[$name] = $fields;
}
}
}