Skip to content

Commit 4218276

Browse files
Backport #1503 (#1545)
* Backport #1503 * Update CHANGELOG.md --------- Co-authored-by: Till Krüss <[email protected]>
1 parent afa8b55 commit 4218276

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
## Changelog
22

33
## Unreleased
4-
### Added
5-
### Changed
64
### Fixed
5+
- Fixed PHP 8.4 deprecated call to `stream_context_set_option()`
76

87
## v3.0.1 (2025-05-16)
98
### Fixed

src/Connection/Resource/StreamFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ protected function tlsStreamInitializer(ParametersInterface $parameters)
168168
$options['crypto_type'] = STREAM_CRYPTO_METHOD_TLS_CLIENT;
169169
}
170170

171-
if (!stream_context_set_option($resource, ['ssl' => $options])) {
171+
$context_options = function_exists('stream_context_set_options')
172+
? stream_context_set_options($resource, ['ssl' => $options])
173+
: stream_context_set_option($resource, ['ssl' => $options]);
174+
175+
if (!$context_options) {
172176
$this->onInitializationError($resource, $parameters, 'Error while setting SSL context options');
173177
}
174178

0 commit comments

Comments
 (0)