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

Skip to content

Commit ab4ce4a

Browse files
Allow negative timeout/read_timeout and fix doc
Co-authored-by: twosee <[email protected]>
1 parent b995072 commit ab4ce4a

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

README.markdown

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ _**Description**_: Connects to a Redis instance.
223223

224224
*host*: string. can be a host, or the path to a unix domain socket. Starting from version 5.0.0 it is possible to specify schema
225225
*port*: int, optional
226-
*timeout*: float, value in seconds (optional, default is 0 meaning unlimited)
226+
*timeout*: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout)
227227
*reserved*: should be '' if retry_interval is specified
228228
*retry_interval*: int, value in milliseconds (optional)
229-
*read_timeout*: float, value in seconds (optional, default is 0 meaning unlimited)
229+
*read_timeout*: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout)
230230
*others*: array, with PhpRedis >= 5.3.0, it allows setting _auth_ and [_stream_](https://www.php.net/manual/en/context.ssl.php) configuration.
231231

232232
##### *Return value*
@@ -271,10 +271,10 @@ persistent equivalents.
271271

272272
*host*: string. can be a host, or the path to a unix domain socket. Starting from version 5.0.0 it is possible to specify schema
273273
*port*: int, optional
274-
*timeout*: float, value in seconds (optional, default is 0 meaning unlimited)
274+
*timeout*: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout)
275275
*persistent_id*: string. identity for the requested persistent connection
276276
*retry_interval*: int, value in milliseconds (optional)
277-
*read_timeout*: float, value in seconds (optional, default is 0 meaning unlimited)
277+
*read_timeout*: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout)
278278

279279
##### *Return value*
280280

cluster_library.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2873,12 +2873,12 @@ cluster_validate_args(double timeout, double read_timeout, HashTable *seeds,
28732873
{
28742874
zend_string **retval;
28752875

2876-
if (timeout < 0L || timeout > INT_MAX) {
2876+
if (timeout > INT_MAX) {
28772877
if (errstr) *errstr = "Invalid timeout";
28782878
return NULL;
28792879
}
28802880

2881-
if (read_timeout < 0L || read_timeout > INT_MAX) {
2881+
if (read_timeout > INT_MAX) {
28822882
if (errstr) *errstr = "Invalid read timeout";
28832883
return NULL;
28842884
}

redis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,12 +718,12 @@ redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
718718
persistent_id = NULL;
719719
}
720720

721-
if (timeout < 0L || timeout > INT_MAX) {
721+
if (timeout > INT_MAX) {
722722
REDIS_VALUE_EXCEPTION("Invalid connect timeout");
723723
return FAILURE;
724724
}
725725

726-
if (read_timeout < 0L || read_timeout > INT_MAX) {
726+
if (read_timeout > INT_MAX) {
727727
REDIS_VALUE_EXCEPTION("Invalid read timeout");
728728
return FAILURE;
729729
}

redis_sentinel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ PHP_METHOD(RedisSentinel, __construct)
6161
RETURN_THROWS();
6262
}
6363

64-
if (timeout < 0L || timeout > INT_MAX) {
64+
if (timeout > INT_MAX) {
6565
REDIS_VALUE_EXCEPTION("Invalid connect timeout");
6666
RETURN_THROWS();
6767
}
6868

69-
if (read_timeout < 0L || read_timeout > INT_MAX) {
69+
if (read_timeout > INT_MAX) {
7070
REDIS_VALUE_EXCEPTION("Invalid read timeout");
7171
RETURN_THROWS();
7272
}

0 commit comments

Comments
 (0)