joelcox / codeigniter-redis

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

method _bulk_reply is not returning the correct data #57

Closed DaLt0n closed 10 years ago

DaLt0n commented 10 years ago

Redis protocol sends a "CRLF" when it returns a string with zero length ($0), but when it returns a string "-1" ($-1) length it does not have a "CRLF". Solution is to remove "CRLF" when its a zero length string.

-- CIRedis::_bulk_reply -- remove: if ($value_length <= 0) return NULL; add: if ($value_length <= 0) { add: if ($value_length == 0) { add: fgets($this->_connection); add: } add: return NULL; add: }

danhunsaker commented 10 years ago

See also #53.

Please submit a PR for this, since you have a fix already figured out.

eranhazout commented 10 years ago

Tried that. and now I'm getting null response..

    if ($value_length <= 0){
        if ($value_length == 0){
        fgets($this->_connection, $value_length + 1);
        }
        return NULL;
    }
DaLt0n commented 10 years ago

http://redis.io/topics/protocol