8000 [Mailer] Improve error message when STARTTLS fails by nicolas-grekas · Pull Request #43238 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Mailer] Improve error message when STARTTLS fails #43238

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

Merged
merged 1 commit into from
Sep 28, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,14 @@ public function initialize(): void

public function startTLS(): bool
{
return (bool) stream_socket_enable_crypto($this->stream, true);
set_error_handler(function ($type, $msg) {
throw new TransportException('Unable to connect with STARTTLS: '.$msg);
});
try {
return stream_socket_enable_crypto($this->stream, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you remove the (bool) cast. Is it expected ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function returns int only when a non blocking stream is passes, which is never the case here and would be unsupported anyway

} finally {
restore_error_handler();
}
}

public function terminate(): void
Expand Down
0