mirror of
https://github.com/predis/predis.git
synced 2026-09-11 02:46:59 +00:00
Fixed client_info connection parameter being ignored (#1722)
* Fixed `client_info` connection parameter being ignored * Documented the default value of the `client_info` parameter
This commit is contained in:
committed by
GitHub
parent
3a8c350f3d
commit
e7b89c14b7
@@ -5,6 +5,7 @@
|
||||
### Changed
|
||||
### Fixed
|
||||
- Fixed RESP3 double parsing returning positive `INF` for `-inf` payloads (#1716)
|
||||
- Fixed `client_info` connection parameter being ignored (#1722)
|
||||
|
||||
## v3.6.0 (2026-08-14)
|
||||
### Added
|
||||
|
||||
@@ -208,13 +208,15 @@ class Factory implements FactoryInterface
|
||||
);
|
||||
}
|
||||
|
||||
$connection->addConnectCommand(
|
||||
new RawCommand('CLIENT', ['SETINFO', 'LIB-NAME', $this->buildLibraryName()])
|
||||
);
|
||||
if ($parameters->client_info ?? true) {
|
||||
$connection->addConnectCommand(
|
||||
new RawCommand('CLIENT', ['SETINFO', 'LIB-NAME', $this->buildLibraryName()])
|
||||
);
|
||||
|
||||
$connection->addConnectCommand(
|
||||
new RawCommand('CLIENT', ['SETINFO', 'LIB-VER', Client::VERSION])
|
||||
);
|
||||
$connection->addConnectCommand(
|
||||
new RawCommand('CLIENT', ['SETINFO', 'LIB-VER', Client::VERSION])
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($parameters->database) && strlen($parameters->database)) {
|
||||
$connection->addConnectCommand(
|
||||
|
||||
@@ -36,7 +36,7 @@ use Predis\Retry\Retry;
|
||||
* @property string $database Database index (see the SELECT command).
|
||||
* @property bool $async_connect Performs the connect() operation asynchronously.
|
||||
* @property bool $tcp_nodelay Toggles the Nagle's algorithm for coalescing.
|
||||
* @property bool $client_info Whether to set LIB-NAME and LIB-VER when connecting.
|
||||
* @property bool $client_info Whether to set LIB-NAME and LIB-VER when connecting, enabled by default.
|
||||
* @property Retry $retry Retry configuration
|
||||
* @property bool $cache (Relay only) Whether to use in-memory caching.
|
||||
* @property string $serializer (Relay only) Serializer used for data serialization.
|
||||
|
||||
@@ -585,6 +585,24 @@ class FactoryTest extends PredisTestCase
|
||||
$this->assertSame(['SETINFO', 'LIB-VER', Client::VERSION], $initCommands[2]->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
* @return void
|
||||
*/
|
||||
public function testDoesNotSetClientNameAndVersionOnConnectionWithClientInfoDisabled(): void
|
||||
{
|
||||
$parameters = ['client_info' => false];
|
||||
|
||||
$factory = new Factory();
|
||||
$connection = $factory->create($parameters);
|
||||
$initCommands = $connection->getInitCommands();
|
||||
|
||||
$this->assertCount(1, $initCommands);
|
||||
$this->assertInstanceOf(RawCommand::class, $initCommands[0]);
|
||||
$this->assertSame('HELLO', $initCommands[0]->getId());
|
||||
$this->assertSame([2, 'SETNAME', 'predis'], $initCommands[0]->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user