Skip to content

Commit f06b9da

Browse files
authored
Merge pull request #248 from php-enqueue/amqp-lib-ingore-empty-ssl-options
[amqp-lib] Ignore empty ssl options.
2 parents 0a3b181 + f5d43a8 commit f06b9da

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎pkg/amqp-lib/AmqpConnectionFactory.php‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,21 @@ private function establishConnection()
8787
if (false == $this->connection) {
8888
if ($this->config->getOption('stream')) {
8989
if ($this->config->isSslOn()) {
90+
$sslOptions = array_filter([
91+
'cafile' => $this->config->getSslCaCert(),
92+
'local_cert' => $this->config->getSslCert(),
93+
'local_pk' => $this->config->getSslKey(),
94+
'verify_peer' => $this->config->isSslVerify(),
95+
'verify_peer_name' => $this->config->isSslVerify(),
96+
], function ($value) { return '' !== $value; });
97+
9098
$con = new AMQPSSLConnection(
9199
$this->config->getHost(),
92100
$this->config->getPort(),
93101
$this->config->getUser(),
94102
$this->config->getPass(),
95103
$this->config->getVHost(),
96-
[
97-
'cafile' => $this->config->getSslCaCert(),
98-
'local_cert' => $this->config->getSslCert(),
99-
'local_pk' => $this->config->getSslKey(),
100-
'verify_peer' => $this->config->isSslVerify(),
101-
'verify_peer_name' => $this->config->isSslVerify(),
102-
],
104+
$sslOptions,
103105
[
104106
'insist' => $this->config->getOption('insist'),
105107
'login_method' => $this->config->getOption('login_method'),

‎pkg/amqp-tools/ConnectionConfig.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,23 +293,23 @@ public function isSslVerify()
293293
}
294294

295295
/**
296-
* @return bool
296+
* @return string
297297
*/
298298
public function getSslCaCert()
299299
{
300300
return $this->getOption('ssl_cacert');
301301
}
302302

303303
/**
304-
* @return bool
304+
* @return string
305305
*/
306306
public function getSslCert()
307307
{
308308
return $this->getOption('ssl_cert');
309309
}
310310

311311
/**
312-
* @return bool
312+
* @return string
313313
*/
314314
public function getSslKey()
315315
{
@@ -320,7 +320,7 @@ public function getSslKey()
320320
* @param string $name
321321
* @param mixed $default
322322
*
323-
* @return bool
323+
* @return mixed
324324
*/
325325
public function getOption($name, $default = null)
326326
{

0 commit comments

Comments
 (0)