joelcox/codeigniter-redis — pull request #13 by tinkertim (2012-05-06 17:45:54+00:00)
Title: Don't try to read zero bytes in `_bulk_reply()`

While investigating transactions blocking indefinitely (or taking minutes to return) I
realized that we only return `NULL` in `_bulk_reply()` if we detect there are less than
zero bytes to read, but continue if there are non-zero (including zero) bytes to read.

Since the length value passed to `fgets()` is padded by one (+1), we perenially block
for a byte that just does not exist in the stream in that case.

This trivial patch fixes that, and working with transactions works fine using the existing
magic method (and can now be tested).

Signed-off-by: Tim Post