Skip to content

Commit 4cf7677

Browse files
committed
Make sure stream exists when checking for EOF.
Addressing issue phpredis#143.
1 parent c18dcca commit 4cf7677

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

library.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ PHPAPI void redis_stream_close(RedisSock *redis_sock TSRMLS_DC) {
3131

3232
PHPAPI int redis_check_eof(RedisSock *redis_sock TSRMLS_DC)
3333
{
34-
int eof = php_stream_eof(redis_sock->stream);
34+
int eof;
3535
int count = 0;
36+
37+
if (!redis_sock->stream)
38+
return -1;
39+
40+
eof = php_stream_eof(redis_sock->stream);
3641
while(eof) {
3742
if((MULTI == redis_sock->mode) || redis_sock->watching || count++ == 10) { /* too many failures */
3843
if(redis_sock->stream) { /* close stream if still here */

0 commit comments

Comments
 (0)