1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-22 23:40:12 +02:00

[ticket/15150] Use stream_* functions instead of socket_* functions

PHPBB3-15150
This commit is contained in:
Rubén Calvo 2017-04-04 14:14:48 +02:00
parent d44dde390a
commit eadd5851d0

View File

@ -102,7 +102,7 @@ class jabber
*/ */
static public function can_use_tls() static public function can_use_tls()
{ {
if (!@extension_loaded('openssl') || !function_exists('stream_socket_enable_crypto') || !function_exists('stream_get_meta_data') || !function_exists('socket_set_blocking') || !function_exists('stream_get_wrappers')) if (!@extension_loaded('openssl') || !function_exists('stream_socket_enable_crypto') || !function_exists('stream_get_meta_data') || !function_exists('stream_set_blocking') || !function_exists('stream_get_wrappers'))
{ {
return false; return false;
} }
@ -268,8 +268,8 @@ class jabber
if ($this->connection = @stream_socket_client($remote_socket, $errorno, $errorstr, $this->timeout, STREAM_CLIENT_CONNECT, $socket_context)) if ($this->connection = @stream_socket_client($remote_socket, $errorno, $errorstr, $this->timeout, STREAM_CLIENT_CONNECT, $socket_context))
{ {
socket_set_blocking($this->connection, 0); stream_set_blocking($this->connection, 0);
socket_set_timeout($this->connection, 60); stream_set_timeout($this->connection, 60);
return true; return true;
} }
@ -586,7 +586,7 @@ class jabber
case 'proceed': case 'proceed':
// continue switching to TLS // continue switching to TLS
$meta = stream_get_meta_data($this->connection); $meta = stream_get_meta_data($this->connection);
socket_set_blocking($this->connection, 1); stream_set_blocking($this->connection, 1);
if (!stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) if (!stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT))
{ {
@ -594,7 +594,7 @@ class jabber
return false; return false;
} }
socket_set_blocking($this->connection, $meta['blocked']); stream_set_blocking($this->connection, $meta['blocked']);
$this->session['tls'] = true; $this->session['tls'] = true;
// new stream // new stream