
Description
While I was retrieving some JSON (rather huge sets) I noticed that _single_line_reply()
was returning only a (large) random chunk of what it should. The chunk was usually 8192 bytes, but sometimes 16k. The same thing happened with base64 encoded data larger than ~32k .
Identical behavior happens when data is just serialized prior to setting. Yet, a GET
from redis console produces the entire thing perfectly.
My understanding of fgets()
is the same as in the documentation:
Reading ends when length - 1 bytes have been read, on a newline (which is included in the return value), or on EOF (whichever comes first). If no length is specified, it will keep reading from the stream until it reaches the end of the line.
Try it with any large serialized array ( > 8k) e.g.
$redis->set('foo', serialize($big_array));
Then observe what you see via $redis->get('foo')
vs what you see via GET foo
in the console. I checked the points at which it chomped the data and there was no newline (escaped or otherwise) at that point. Always at 8k or 16k.
Can anyone reproduce this?