Skip to content

Commit

Permalink
Merge branch 'hotfix/smtp-auth-does-not-reset-at-quit' of https://git…
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDotPro committed Jun 20, 2013
2 parents 8ccf970 + a22bcd4 commit 5482d00
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions library/Zend/Mail/Protocol/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public function vrfy($user)
public function quit()
{
if ($this->sess) {
$this->auth = false;
$this->_send('QUIT');
$this->_expect(221, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
$this->_stopSession();
Expand Down
10 changes: 10 additions & 0 deletions tests/ZendTest/Mail/Protocol/SmtpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,14 @@ public function testDisconnectCallsQuit()
$this->connection->disconnect();
$this->assertTrue($this->connection->calledQuit);
}

public function testDisconnectResetsAuthFlag()
{
$this->connection->connect();
$this->connection->setSessionStatus(true);
$this->connection->setAuth(true);
$this->assertTrue($this->connection->getAuth());
$this->connection->disconnect();
$this->assertFalse($this->connection->getAuth());
}
}
47 changes: 47 additions & 0 deletions tests/ZendTest/Mail/TestAsset/SmtpProtocolSpy.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SmtpProtocolSpy extends Smtp
public function connect()
{
$this->connect = true;

return true;
}

Expand Down Expand Up @@ -107,4 +108,50 @@ public function getRecipients()
{
return $this->rcptTest;
}

/**
* Get Auth Status
*
* @return bool
*/
public function getAuth()
{
return $this->auth;
}

/**
* Set Auth Status
*
* @param bool $status
* @return self
*/
public function setAuth($status)
{
$this->auth = (bool) $status;

return $this;
}

/**
* Get Session Status
*
* @return bool
*/
public function getSessionStatus()
{
return $this->sess;
}

/**
* Set Session Status
*
* @param bool $status
* @return self
*/
public function setSessionStatus($status)
{
$this->sess = (bool) $status;

return $this;
}
}

0 comments on commit 5482d00

Please sign in to comment.