With an open connection to Redis, a set command using "EX" or "PX" that has a corresponding float value for TTL will raise the PHP Warning "EXPIRE can't be < 1" even when the value of the float is greater than 1.
I understand that Redis requires an integer for expiry/TTL, but the extension should either raise a type error when a float is passed or convert float values to integer internally. As it is, the warning is entirely misleading.
Expected behaviour
The following command should return true or a error should be raised for the invalid ttl type
$redis->set("my_key", true, ["NX", "EX" => 300.0]);
Actual behaviour
The following warning is raised:
E_WARNING: Redis::set(): EXPIRE can't be < 1
I'm seeing this behaviour on
- OS: Debian (docker container)
- Redis: 7.0 (though it's not interacting with Redis so this is irrelevant)
- PHP: 8.2.9
- phpredis: latest (installed through pecl)
With an open connection to Redis, a
setcommand using "EX" or "PX" that has a correspondingfloatvalue for TTL will raise the PHP Warning "EXPIRE can't be < 1" even when the value of the float is greater than 1.I understand that Redis requires an integer for expiry/TTL, but the extension should either raise a type error when a float is passed or convert float values to integer internally. As it is, the warning is entirely misleading.
Expected behaviour
The following command should return
trueor a error should be raised for the invalid ttl type$redis->set("my_key", true, ["NX", "EX" => 300.0]);Actual behaviour
The following warning is raised:
E_WARNING: Redis::set(): EXPIRE can't be < 1I'm seeing this behaviour on