There does not seem to be any value that can be used for $persistent_id in
$redis->pconnect($host, $port, $timeout, $persistent_id);
such that Phpredis re-uses a connection established by omitting this parameter:
$redis->pconnect($host, $port, $timeout);
I've tried to pass '', null, true, false and 0. All are treated differently than omitting the parameter completely, i.e. a new connection is established.
Expected behaviour
When I call the pconnect method with persistent_id = '' then Phpredis should behave the same as if I omitted this parameter (because the empty string is documented as the default value).
Actual behaviour
Phpredis treats persistent_id = '' differently than omitting this parameter.
I'm seeing this behaviour on
- OS: Linux
- Redis: 4.0.1
- PHP: 7.1.9
- phpredis: 3.1.3 and 3.1.4 RC1
Steps to reproduce, backtrace or example script
<?php
$redis1 = new \Redis();
$redis1->pconnect('127.0.0.1', 6379, 0.0);
$redis2 = new \Redis();
$redis2->pconnect('127.0.0.1', 6379, 0.0, '');
echo getmypid() . "\n";
sleep(60);
Then, in another console tab, run ss -p | grep "pid=PID" (replace PIDwith the output of the script) to check how many Redis connections the script has established. Expected value: 1. Actual value: 2.
I've checked
There does not seem to be any value that can be used for
$persistent_idin$redis->pconnect($host, $port, $timeout, $persistent_id);such that Phpredis re-uses a connection established by omitting this parameter:
$redis->pconnect($host, $port, $timeout);I've tried to pass
'',null,true,falseand0. All are treated differently than omitting the parameter completely, i.e. a new connection is established.Expected behaviour
When I call the
pconnectmethod withpersistent_id = ''then Phpredis should behave the same as if I omitted this parameter (because the empty string is documented as the default value).Actual behaviour
Phpredis treats
persistent_id = ''differently than omitting this parameter.I'm seeing this behaviour on
Steps to reproduce, backtrace or example script
Then, in another console tab, run
ss -p | grep "pid=PID"(replacePIDwith the output of the script) to check how many Redis connections the script has established. Expected value: 1. Actual value: 2.I've checked
developbranch