From 4f0ad25fabdda0b4a1f659d55acf3bd1e6abd5a1 Mon Sep 17 00:00:00 2001 From: Beno!t POLASZEK Date: Tue, 4 Jun 2019 15:59:49 +0200 Subject: [PATCH] Set default crypto method - Fix #31105 --- .../Component/Mailer/Transport/Smtp/Stream/SocketStream.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php index 07692b11ba..308201d538 100644 --- a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php +++ b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php @@ -140,6 +140,9 @@ final class SocketStream extends AbstractStream if ($this->streamContextOptions) { $options = array_merge($options, $this->streamContextOptions); } + if ($this->isTLS()) { + $options['ssl']['crypto_method'] = $options['ssl']['crypto_method'] ?? STREAM_CRYPTO_METHOD_TLS_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; + } $streamContext = stream_context_create($options); $this->stream = @stream_socket_client($this->url, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $streamContext); if (false === $this->stream) {