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

Skip to content

Commit 34c8c68

Browse files
authored
Merge pull request #1531 from phpredis/issue.1523
Issue #1523 Let's merge it and see users reaction 🤣
2 parents 95efd21 + e8fb49b commit 34c8c68

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

library.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2340,11 +2340,19 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size,
23402340
if(php_stream_get_line(redis_sock->stream, buf, buf_size, line_size)
23412341
== NULL)
23422342
{
2343+
char *errmsg = NULL;
2344+
2345+
if (redis_sock->port < 0) {
2346+
spprintf(&errmsg, 0, "read error on connection to %S", redis_sock->host);
2347+
} else {
2348+
spprintf(&errmsg, 0, "read error on connection to %S:%d", redis_sock->host, redis_sock->port);
2349+
}
23432350
// Close our socket
23442351
redis_sock_disconnect(redis_sock, 1 TSRMLS_CC);
23452352

23462353
// Throw a read error exception
2347-
REDIS_THROW_EXCEPTION( "read error on connection", 0);
2354+
REDIS_THROW_EXCEPTION(errmsg, 0);
2355+
efree(errmsg);
23482356
return -1;
23492357
}
23502358

0 commit comments

Comments
 (0)