[Messenger] Typecast the auto-setup as a bool.

This commit is contained in:
David Barratt 2018-04-21 11:20:18 -04:00 committed by Fabien Potencier
parent 833909bd68
commit 566a8be35b
2 changed files with 7 additions and 1 deletions

View File

@ -218,6 +218,6 @@ class Connection
private function shouldSetup(): bool
{
return !array_key_exists('auto-setup', $this->connectionCredentials) || 'false' !== $this->connectionCredentials['auto-setup'];
return !array_key_exists('auto-setup', $this->connectionCredentials) || !in_array($this->connectionCredentials['auto-setup'], array(false, 'false'), true);
}
}

View File

@ -182,6 +182,12 @@ class ConnectionTest extends TestCase
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', array('auto-setup' => 'false'), true, $factory);
$connection->publish('body');
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key', array('auto-setup' => false), true, $factory);
$connection->publish('body');
$connection = Connection::fromDsn('amqp://localhost/%2f/messages?queue[routing_key]=my_key&auto-setup=false', array(), true, $factory);
$connection->publish('body');
}
}