Skip to content

Commit

Permalink
Handle MS Exchange returning invalid empty AUTH type list, fixes PHPM…
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Aug 1, 2015
1 parent 0639590 commit 41d7273
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -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
Expand Down
19 changes: 15 additions & 4 deletions class.smtp.php
Expand Up @@ -723,9 +723,11 @@ protected function parseHelloFields($type)
{
$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);
Expand All @@ -735,11 +737,20 @@ protected function parseHelloFields($type)
$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;
}
}
}
Expand Down

0 comments on commit 41d7273

Please sign in to comment.