Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
When the SMTP destructs the socket gets closed automatically to free …
Browse files Browse the repository at this point in the history
…up resources which is good, hoewever when the SMTP Transport desctructs it also calls the disconnect on the SMTP Protocol which is in the middle of destruction and does not have a valid socket anymore. At that moment the sess is still set to true resulting in an Exception on destruction. Implementint / overriding the _disconnect from the SMTP protocol makes sure quit gets issued as well. Quit in itself already checks if the session is still there and makes sure the session gets set to false after quitting.
  • Loading branch information
bboer committed Feb 1, 2013
1 parent 2a02c66 commit 9e456df
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion library/Zend/Mail/Protocol/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,18 @@ public function auth()
*/
public function disconnect()
{
$this->quit();
$this->_disconnect();
}

/**
* Disconnect from remote host and free resource
*/
protected function _disconnect()
{
// Make sure the session gets closed
$this->quit();
parent::_disconnect();
}

/**
* Start mail session
Expand Down

0 comments on commit 9e456df

Please sign in to comment.