memcached error (fwd)
Brad Fitzpatrick
brad at danga.com
Tue Dec 28 11:28:21 PST 2004
For the PHP folk...
---------- Forwarded message ----------
Date: Tue, 28 Dec 2004 13:43:30 +0300
From: Lebedev Pavel <pavel at mbd.ru>
To: brad at danga.com
Subject: memcached error
Hello, Brad Fitzpatrick's!
I find error in MemCachedClient.inc.php Release 1.0.10
In case of data end sign ( /r/nEND/r/n ) be at edge of 2 block, the script fall down.
But the following condition must be meeted: last /n is only symbol of last block ($line="\n").
In this case next expression donn`t allow perform end sign checking:
// skip over the extra return or newline
if($line == "\r" || $line == "\n")
continue;
$bytes_read += strlen($line);
$buf .= $line;
// we read the all of the data, take in account
// for the /r/nEND/r/n
if($bytes_read == ($len + 7))
{
$end = substr($buf, $len+2, 3);
...................................................
Example of code, that result fall down:
require_once('system/MemCachedClient.inc.php');
$options["servers"] = array("127.0.0.1:11212");
$options["debug"] = false;
$options["compress"] = 0;
$memc = new MemCachedClient($options);
$str = str_repeat('1', 994);
$memc->set('key', $str);
echo $memc->get('key'); // here script fall
____________________
Pavel Lebedev
More information about the memcached
mailing list