diff --git a/src/Smtp.php b/src/Smtp.php index 456e386..72fe45f 100644 --- a/src/Smtp.php +++ b/src/Smtp.php @@ -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); diff --git a/src/Tcpclient.php b/src/Tcpclient.php index 40df15a..459f8a5 100644 --- a/src/Tcpclient.php +++ b/src/Tcpclient.php @@ -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); diff --git a/src/Tcpserver.php b/src/Tcpserver.php index fa60713..bc6eb2d 100644 --- a/src/Tcpserver.php +++ b/src/Tcpserver.php @@ -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); }