Fix PHP error when imap_conn_options.proxy_protocol is not an array

This commit is contained in:
Aleksander Machniak
2023-06-02 14:46:01 +02:00
parent 44a4496302
commit a55061dfae
2 changed files with 7 additions and 6 deletions

View File

@@ -323,11 +323,11 @@ $config['smtp_timeout'] = 0;
// The example below enables server certificate validation, and
// requires 'smtp_timeout' to be non zero.
// $config['smtp_conn_options'] = [
// 'ssl' => [
// 'verify_peer' => true,
// 'verify_depth' => 3,
// 'cafile' => '/etc/openssl/certs/ca.crt',
// ],
// 'ssl' => [
// 'verify_peer' => true,
// 'verify_depth' => 3,
// 'cafile' => '/etc/openssl/certs/ca.crt',
// ],
// ];
// Note: These can be also specified as an array of options indexed by hostname
$config['smtp_conn_options'] = null;

View File

@@ -1054,7 +1054,8 @@ class rcube_imap_generic
}
if (!empty($this->prefs['socket_options'])) {
$context = stream_context_create($this->prefs['socket_options']);
$options = array_intersect_key($this->prefs['socket_options'], ['ssl' => 1]);
$context = stream_context_create($options);
$this->fp = stream_socket_client($host . ':' . $port, $errno, $errstr,
$this->prefs['timeout'], STREAM_CLIENT_CONNECT, $context);
}