From 37aa6fb515f3d001daecb91ae68f42c207c13440 Mon Sep 17 00:00:00 2001 From: Nicolas Chapleau Date: Wed, 22 Jan 2025 12:08:12 -0500 Subject: [PATCH] PHP 8.4.0 compatibility with call to stream_context_set_option (#1503) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Till Krüss --- src/Connection/StreamConnection.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Connection/StreamConnection.php b/src/Connection/StreamConnection.php index 18827c1c..0d872e00 100644 --- a/src/Connection/StreamConnection.php +++ b/src/Connection/StreamConnection.php @@ -211,7 +211,11 @@ class StreamConnection extends AbstractConnection $options['crypto_type'] = STREAM_CRYPTO_METHOD_TLS_CLIENT; } - if (!stream_context_set_option($resource, ['ssl' => $options])) { + $context_options = function_exists('stream_context_set_options') + ? stream_context_set_options($resource, ['ssl' => $options]) + : stream_context_set_option($resource, ['ssl' => $options]); + + if (!$context_options) { $this->onConnectionError('Error while setting SSL context options'); }