PHP8.4 Deprecation stream_context_set_option -> stream_context_set_options

This commit is contained in:
2025-09-12 11:52:19 +02:00
parent b2a4cbff01
commit 8b1faf795c
3 changed files with 16 additions and 3 deletions

View File

@@ -123,7 +123,11 @@ class Smtp
$this->putLine("STARTTLS\r\n");
$context["ssl"]["verify_peer_name"] = $this->starttlsCheck;
$context["ssl"]["verify_peer"] = $this->starttlsCheck;
stream_context_set_option($this->smtpStream, $context);
if (version_compare(PHP_VERSION, '8.3.0') <= 0) {
stream_context_set_option($this->smtpStream, $context);
} else {
stream_context_set_options($this->smtpStream, $context);
}
// The track_errors permit to create the $php_errormsg in case of
// warning
ini_set('track_errors', 1);

View File

@@ -246,9 +246,14 @@ class Tcpclient
"capture_peer_cert_chain" => true,
"SNI_enabled" => true,
]];
$optionsMerged = [];
$optionsMerged["ssl"] = array_merge($optionsBase["ssl"], $options);
stream_set_blocking($this->socket, true);
stream_context_set_option($this->socket, $optionsMerged);
if (version_compare(PHP_VERSION, '8.3.0') <= 0) {
stream_context_set_option($this->socket, $optionsMerged);
} else {
stream_context_set_options($this->socket, $optionsMerged);
}
$php_errormsg = "";
ini_set("track_errors", 1);
$rc = @stream_socket_enable_crypto($this->socket, !!$val, $cryptoMethod);

View File

@@ -496,7 +496,11 @@ class Tcpserver
"verify_peer_name" => false,
]];
stream_set_blocking($this->socket, true);
stream_context_set_option($this->socket, $options);
if (version_compare(PHP_VERSION, '8.3.0') <= 0) {
stream_context_set_option($this->socket, $options);
} else {
stream_context_set_options($this->socket, $options);
}
return @stream_socket_enable_crypto($this->socket, !!$val, $cryptoMethod);
}