Skip to content

Commit d5f69f2

Browse files
David Barrattfabpot
authored andcommitted
[Messenger] Typecast the auto-setup as a bool.
1 parent 981e67d commit d5f69f2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Adapter/AmqpExt/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,6 @@ private function clear(): void
218218

219219
private function shouldSetup(): bool
220220
{
221-
return !array_key_exists('auto-setup', $this->connectionCredentials) || 'false' !== $this->connectionCredentials['auto-setup'];
221+
return !array_key_exists('auto-setup', $this->connectionCredentials) || !in_array($this->connectionCredentials['auto-setup'], array(false, 'false'), true);
222222
}
223223
}

Tests/Adapter/AmqpExt/ConnectionTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ public function testItCanDisableTheSetup()
182182

183183
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', array('auto-setup' => 'false'), true, $factory);
184184
$connection->publish('body');
185+
186+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', array('auto-setup' => false), true, $factory);
187+
$connection->publish('body');
188+
189+
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key&auto-setup=false', array(), true, $factory);
190+
$connection->publish('body');
185191
}
186192
}
187193

0 commit comments

Comments
 (0)