10fingers - 19 December 2008 02:33 PM
I found a bug (or feature): when the arguments to function is not a scalar variables — then the MD5 hash is the same for all calls. In my case I pass the arrays as arguments so I made small modification in your library:
original code
function mkid($id) {
// Build the id. The name is an MD5 hash of the $id array
$idstr = '';
foreach($id as $e) {
$idstr .= $e . '::';
}
return md5($idstr);
}
modified code
function mkid($id) {
// Build the id. The name is an MD5 hash of the $id array
$idstr = '';
foreach($id as $e) {
$idstr .= (is_array($e) ? $this->mkid( $e ) : $e) . '::';
}
return md5($idstr);
}
I just check the type of variable and run into recursion if it is not scalar.
I use CO1.3,and when I runing example, an error occured:
A PHP Error was encountered
Severity: Notice
Message: Constant MEMCACHE_COMPRESSED already defined
Filename: helpers/co_memcached_helper.php
Line Number: 92
has it something wrong?
change 92 line:
define(“MEMCACHE_COMPRESSED”, 1<<1);
to:
//define(“MEMCACHE_COMPRESSED”, 1<<1);
it’s OK.
when I restart memcached service,and another error:
A PHP Error was encountered
Severity: Notice
Message: fwrite() [function.fwrite]: send of 38 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
Filename: helpers/co_memcached_helper.php
Line Number: 395