Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Smith <owen.rl.smith@gmail.com>2019-07-17 22:04:05 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2019-07-29 18:04:02 +0300
commit135a62de6e0f59f7a9f4af653ce02832a2cfae7d (patch)
tree93dd6e27288b870b6db81485d2d8a38833ba1823
parent6a5c17a0b81f9604223dbe1894732808a88f91e6 (diff)
Fix "No such file or directory" when connecting to ports >= 32768 (#1602)
* Fix `connect` for port numbers >=32768: Since 5.0.0, using a high enough port number gives a "No such file or directory" error, because type casts treat high ports as -ve which awkwardly triggers the unix-socket-path behaviour. * clean up guard condition
-rw-r--r--common.h2
-rw-r--r--redis.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/common.h b/common.h
index 6770f950..e1de200f 100644
--- a/common.h
+++ b/common.h
@@ -246,7 +246,7 @@ typedef struct fold_item {
typedef struct {
php_stream *stream;
zend_string *host;
- short port;
+ unsigned short port;
zend_string *auth;
double timeout;
double read_timeout;
diff --git a/redis.c b/redis.c
index 3a0b6973..fbc2fee2 100644
--- a/redis.c
+++ b/redis.c
@@ -978,6 +978,10 @@ redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
port = 6379;
}
+ if (port < 0) {
+ port = 0;
+ }
+
redis = PHPREDIS_GET_OBJECT(redis_object, object);
/* if there is a redis sock already we have to remove it */
if (redis->sock) {