Skip to content

Commit

Permalink
Fix deprecation on PHP 8.3 with stream_context_set_option
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Feb 13, 2024
1 parent eb6c5e6 commit 2abc297
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Internal/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ function setupTls($socket, array $options, ?Cancellation $cancellation): void
}

\error_clear_last();

if (PHP_VERSION_ID >= 80300) {
/** @psalm-suppress UndefinedFunction */
\stream_context_set_options($socket, $options);
} else {
\stream_context_set_option($socket, $options);
}

\stream_context_set_option($socket, $options);

$errorHandler = static function (int $errno, string $errstr) use ($socket): never {
Expand Down

0 comments on commit 2abc297

Please sign in to comment.