10000 [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
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