Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3eb60f5

Browse files
authored
Merge pull request #2388 from phpredis/issue-2385
Fix unknown expiration modifier warning when null argument passed
2 parents 7825efb + 95bd184 commit 3eb60f5

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

redis.stub.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,8 +1091,9 @@ public function exists(mixed $key, mixed ...$other_keys): Redis|int|bool;
10911091
* redis-server >= 7.0.0 you may send an additional "mode" argument which
10921092
* modifies how the command will execute.
10931093
*
1094-
* @param string $key The key to set an expiration on.
1095-
* @param string $mode A two character modifier that changes how the
1094+
* @param string $key The key to set an expiration on.
1095+
* @param int $timeout The number of seconds after which key will be automatically deleted.
1096+
* @param string|null $mode A two character modifier that changes how the
10961097
* command works.
10971098
* <code>
10981099
* NX - Set expiry only if key has no expiry
@@ -1122,9 +1123,9 @@ public function expire(string $key, int $timeout, ?string $mode = null): Redis|b
11221123
/**
11231124
* Set a key to expire at an exact unix timestamp.
11241125
*
1125-
* @param string $key The key to set an expiration on.
1126-
* @param int $timestamp The unix timestamp to expire at.
1127-
* @param string $mode An option 'mode' that modifies how the command acts (see {@link Redis::expire}).
1126+
* @param string $key The key to set an expiration on.
1127+
* @param int $timestamp The unix timestamp to expire at.
1128+
* @param string|null $mode An option 'mode' that modifies how the command acts (see {@link Redis::expire}).
11281129
* @return Redis|bool True if an expiration was set, false if not.
11291130
*
11301131
* @see https://redis.io/commands/expireat
@@ -2256,8 +2257,9 @@ public function persist(string $key): Redis|bool;
22562257
*
22572258
* @see Redis::expire() for a description of the mode argument.
22582259
*
2259-
* @param string $key The key to set an expiration on.
2260-
* @param string $mode A two character modifier that changes how the
2260+
* @param string $key The key to set an expiration on.
2261+
* @param int $timeout The number of milliseconds after which key will be automatically deleted.
2262+
* @param string|null $mode A two character modifier that changes how the
22612263
* command works.
22622264
*
22632265
* @return Redis|bool True if an expiry was set on the key, and false otherwise.
@@ -2270,8 +2272,9 @@ public function pexpire(string $key, int $timeout, ?string $mode = null): bool;
22702272
*
22712273
* @see Redis::expire() For a description of the mode argument.
22722274
*
2273-
* @param string $key The key to set an expiration on.
2274-
* @param string $mode A two character modifier that changes how the
2275+
* @param string $key The key to set an expiration on.
2276+
* @param int $timestamp The unix timestamp to expire at.
2277+
* @param string|null $mode A two character modifier that changes how the
22752278
* command works.
22762279
*
22772280
* @return Redis|bool True if an expiration was set on the key, false otherwise.

redis_commands.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6002,7 +6002,7 @@ int redis_expire_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
60026002
Z_PARAM_STR(key)
60036003
Z_PARAM_LONG(timeout)
60046004
Z_PARAM_OPTIONAL
6005-
Z_PARAM_STR(mode)
6005+
Z_PARAM_STR_OR_NULL(mode)
60066006
ZEND_PARSE_PARAMETERS_END_EX(return FAILURE);
60076007

60086008
if (mode != NULL && !(zend_string_equals_literal_ci(mode, "NX") ||

0 commit comments

Comments
 (0)