Commit 1f41da64 authored by Owen Smith's avatar Owen Smith Committed by Michael Grunder
Browse files

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
parent 4ab69b1d
......@@ -248,7 +248,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;
......
......@@ -1005,6 +1005,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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment