Skip to content

Commit 7164c92

Browse files
Mark Daintomponline
Mark Dain
authored and
tomponline
committed
NATS 1.2.x support: catch not set fields
This commit improves support for NATS 1.2.x by checking if several fields; `auth_required`, `tls_required`, and `tls_verify` are set in the initial INFO packet. As of NATS 1.2, these fields aren't always set, which can cause an E_NOTICE to be raised. Without this change, the unit tests are failing because the Docker container has been updated to 1.2.0, and PHPUnit is configured to treat notices as test failures. See: nats-io/nats-server@17fecd4#diff-91bbeda7eb98a7adc57b9e47e2cf5c2b
1 parent 3a41e8e commit 7164c92

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Nats/ServerInfo.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ public function __construct($connectionResponse)
102102
$this->setPort($data['port']);
103103
$this->setVersion($data['version']);
104104
$this->setGoVersion($data['go']);
105-
$this->setAuthRequired($data['auth_required']);
106-
$this->setTLSRequired($data['tls_required']);
107-
$this->setTLSVerify($data['tls_verify']);
105+
$this->setAuthRequired(isset($data['auth_required']) ? $data['auth_required'] : false);
106+
$this->setTLSRequired(isset($data['tls_required']) ? $data['tls_required'] : false);
107+
$this->setTLSVerify(isset($data['tls_verify']) ? $data['tls_verify'] : false);
108108
$this->setMaxPayload($data['max_payload']);
109109

110110
if (version_compare($data['version'], '1.1.0') === -1) {

0 commit comments

Comments
 (0)