joelcox / codeigniter-redis

A CodeIgniter library to interact with Redis
MIT License
240 stars 142 forks source link

Can't use $this->redis->hvals('key') twice #33

Closed yiichou closed 11 years ago

yiichou commented 11 years ago

After I used $this->redis->hvals('key') once in a request, I found I can't use any method. All of them return empty.

danhunsaker commented 11 years ago

Had a similar issue with Redisent. In their case, when handling batch responses, they were properly handling size values of -1 as null, but not properly handling size values of 0. If a batch result has a length of zero, Redis doesn't return any actual values - which makes sense, since it said it wouldn't. Redisent was interpreting the next value to come back from Redis as part of the response for the batch request, despite the fact that it really had nothing to do with that batch whatsoever.

Not sure if we're seeing something similar here, though. I'll try to have a look later today.

After I used $this->redis->hvals('key') once in a request, I found I can't use any method. All of them return empty.

— Reply to this email directly or view it on GitHubhttps://github.com/joelcox/codeigniter-redis/issues/33 .

joelcox commented 11 years ago

Hey everyone,

I tried recreating the issue, but failed to do so. See the commit above this comment. @xworm could you confirm this is what triggers the error?

Thanks for chiming in Dan. I'll look into that.

yiichou commented 11 years ago

I agree with @danhunsaker . I had stored a php array(a hash, in fact) into redis which some of values were empty string. when I used hvals or hgetall, the issue happened. hkeys was okay. I never tried to use hget to get the empty value, Let me try & see what will be shown.

joelcox commented 11 years ago

Thanks for your response xworm. I managed to create a failing test case using your last comment. See the commit above. I seemed to have fixed this issue (thanks for the pointer Dan!) in the next commit. Can you please confirm?

12ae166edd8a913ea14a8dede501592ababda08e

yiichou commented 11 years ago

Thank you for your contribution to CI & Redis, Joelcox & Dan. This is my first time submitting an issue (I'm not good at English) . I feel very exciting right now Should I close the issue ?

joelcox commented 11 years ago

@xworm if this fixes your problem, you can indeed close it. Thanks for reporting your issue! We're unable to find all these edge cases ourselves, so it's thanks to people like you this library is more or less stable.

Thanks again and please keep sending in issues to project you use :)