Skip to content

Commit

Permalink
fix warning (PHPMailer#761)
Browse files Browse the repository at this point in the history
fix message <b>Warning</b>:  array_key_exists() expects parameter 2 to be array when is bad auth
  • Loading branch information
Offboard authored and Synchro committed Jul 6, 2016
1 parent d7c9ad5 commit 39a2e3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/smtp_check.phps
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ try {
//Get the list of ESMTP services the server offers
$e = $smtp->getServerExtList();
//If server can do TLS encryption, use it
if (array_key_exists('STARTTLS', $e)) {
if (is_array($e) && array_key_exists('STARTTLS', $e)) {
$tlsok = $smtp->startTLS();
if (!$tlsok) {
throw new Exception('Failed to start encryption: ' . $smtp->getError()['error']);
Expand All @@ -41,7 +41,7 @@ try {
$e = $smtp->getServerExtList();
}
//If server supports authentication, do it (even if no encryption)
if (array_key_exists('AUTH', $e)) {
if (is_array($e) && array_key_exists('AUTH', $e)) {
if ($smtp->authenticate('username', 'password')) {
echo "Connected ok!";
} else {
Expand Down

0 comments on commit 39a2e3a

Please sign in to comment.