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

Exception on destructing the SMTP Transport instance #3645

Closed

Conversation

bboer
Copy link
Contributor

@bboer bboer commented Feb 1, 2013

When the SMTP destructs the socket gets closed automatically to free 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.

…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.
@Maks3w
Copy link
Member

Maks3w commented Feb 1, 2013

Please add a test case for this to avoid regressions.

Hint: Create a test asset extending from Smtp class and call the __destruct() method

weierophinney added a commit that referenced this pull request Feb 5, 2013
- Added unit test verifying that quit() gets called
weierophinney added a commit that referenced this pull request Feb 5, 2013
@ghost ghost assigned weierophinney Feb 5, 2013
@weierophinney
Copy link
Member

I've added a unit test, and merged.

@bboer
Copy link
Contributor Author

bboer commented Feb 5, 2013

@weierophinney Thanks, did not get the time to add tests. Am glad it got merged :).

weierophinney added a commit to zendframework/zend-mail that referenced this pull request May 14, 2015
- Added unit test verifying that quit() gets called
weierophinney added a commit to zendframework/zend-mail that referenced this pull request May 14, 2015
weierophinney added a commit to zendframework/zend-mail that referenced this pull request May 14, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants