Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround E_DEPRECATED warning on Auth_SASL::factory() call #29

Merged
merged 10 commits into from
Aug 16, 2016
Prev Previous commit
Next Next commit
Use default error mode in raiseError()
  • Loading branch information
alecpl committed Jul 26, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 1a1174e905bf47a7f147ee96b15877e1b3748e58
26 changes: 7 additions & 19 deletions Net/SMTP.php
Original file line number Diff line number Diff line change
@@ -244,10 +244,8 @@ protected function send($data)

$result = $this->socket->write($data);
if (!$result || PEAR::isError($result)) {
$msg = ($result) ? $result->getMessage() : "unknown error";
return PEAR::raiseError(
"Failed to write to socket: $msg", null, PEAR_ERROR_RETURN
);
$msg = $result ? $result->getMessage() : "unknown error";
return PEAR::raiseError("Failed to write to socket: $msg");
}

return $result;
@@ -276,9 +274,7 @@ protected function put($command, $args = '')
}

if (strcspn($command, "\r\n") !== strlen($command)) {
return PEAR::raiseError(
'Commands cannot contain newlines', null, PEAR_ERROR_RETURN
);
return PEAR::raiseError('Commands cannot contain newlines');
}

return $this->send($command . "\r\n");
@@ -319,9 +315,7 @@ protected function parseResponse($valid, $later = false)
/* If we receive an empty line, the connection was closed. */
if (empty($line)) {
$this->disconnect();
return PEAR::raiseError(
'Connection was closed', null, PEAR_ERROR_RETURN
);
return PEAR::raiseError('Connection was closed');
}

/* Read the code and store the rest in the arguments array. */
@@ -352,9 +346,7 @@ protected function parseResponse($valid, $later = false)
return true;
}

return PEAR::raiseError(
'Invalid response code received from server', $this->code, PEAR_ERROR_RETURN
);
return PEAR::raiseError('Invalid response code received from server', $this->code);
}

/**
@@ -505,9 +497,7 @@ protected function negotiate()
return $error;
}
if (PEAR::isError($this->parseResponse(250))) {
return PEAR::raiseError(
'HELO was not accepted: ', $this->code, PEAR_ERROR_RETURN
);
return PEAR::raiseError('HELO was not accepted', $this->code);
}

return true;
@@ -546,9 +536,7 @@ protected function getBestAuthMethod()
}
}

return PEAR::raiseError(
'No supported authentication methods', null, PEAR_ERROR_RETURN
);
return PEAR::raiseError('No supported authentication methods');
}

/**