Skip to content
Snippets Groups Projects
Commit 40e909f1 authored by pounard's avatar pounard
Browse files

#1513942 - found by David Strauss - Multiple fixes in both lock backends

parent d77f459c
No related merge requests found
......@@ -44,7 +44,7 @@ class Redis_Lock_Backend_PhpRedis extends Redis_Lock_Backend_Default {
return FALSE;
}
return TRUE;
return ($this->_locks[$name] = TRUE);
}
else {
$client->watch($key);
......@@ -81,7 +81,7 @@ class Redis_Lock_Backend_PhpRedis extends Redis_Lock_Backend_Default {
list($value, $owner) = $client->mget(array($key, $key . ':owner'));
return (FALSE !== $value || 0 == $value) && $id == $owner;
return FALSE === $value || $id == $owner;
}
public function lockRelease($name) {
......
......@@ -75,7 +75,7 @@ class Redis_Lock_Backend_Predis extends Redis_Lock_Backend_Default {
// case in which we cannot proceed.
// EXPIRE and SETEX won't return something here, EXEC return is index 2.
// This was determined debugging, seems to be Predis specific.
if (FALSE === $execReply[2] || 1 != $execReply[1]) {
if (FALSE === $execReply[2] || 1 != $execReply[0]) {
return FALSE;
}
......@@ -93,7 +93,7 @@ class Redis_Lock_Backend_Predis extends Redis_Lock_Backend_Default {
list($value, $owner) = $client->mget(array($key, $key . ':owner'));
return (FALSE !== $value || 0 == $value) && $id == $owner;
return empty($value) || $id == $owner;
}
public function lockRelease($name) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment