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

Fixed bug where transport object is reused across stores containing wrong authentication info #398

Open
wants to merge 2 commits into
base: 2.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Mail/Rse/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class Mail
protected $_returnPath = [];

/**
* @var Zend_Mail_Transport_Smtp
* @var array Zend_Mail_Transport_Smtp
*/
protected $_transport;
protected $_transport = [];

/**
* @var array
Expand Down Expand Up @@ -127,7 +127,7 @@ public function setSmtpOptions($storeId, $options = [])
*/
public function getTransport($storeId)
{
if ($this->_transport === null) {
if (!isset($this->_transport[$storeId])) {
if (!isset($this->_smtpOptions[$storeId])) {
$configData = $this->smtpHelper->getSmtpConfig('', $storeId);
$options = [
Expand Down Expand Up @@ -172,16 +172,16 @@ public function getTransport($storeId)

$options = new SmtpOptions($options);

$this->_transport = new Smtp($options);
$this->_transport[$storeId] = new Smtp($options);
} else {
$this->_transport = new Zend_Mail_Transport_Smtp(
$this->_transport[$storeId] = new Zend_Mail_Transport_Smtp(
$this->_smtpOptions[$storeId]['host'],
$this->_smtpOptions[$storeId]
);
}
}

return $this->_transport;
return $this->_transport[$storeId];
}

/**
Expand Down