Skip to content

Strings containing '/n' terminate early when you 'get' them from redis. #24

Open
@paradoxloop

Description

@paradoxloop

I was submitting html(generated with php) into redis for caching. When I tried to retrieve the page it would only return part of the string.

After trying to find a bug in my own code. I checked redis which was definitely storing the whole string. Codeignitor redis would only return part of the string. I tested it in Predis which returned the whole string (as expected).

Example:

$string = "<div><span>Something</span>
<p>Somestuff</p>
</div>
";
$this->redis->set('test',$string);
print $this->redis->get('test');

//Output (not as expected)
<div><span>Something</span>

After playing around with it I realised that string always terminated where an /n appeared in $string (doing a get with redis-cli shows /n in a strings stored).

I tried to find the problem in the codeignitor-redis code but could not.

Work Around Solution:

Do a string replace before setting a string that could contain \n. Hopefully this helps someone else who experienced the same thing.

$string = str_replace("\n",'',$string);

Sorry if this is not a good bug report. It is my first attempt at one.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions