Fix internal flags for MULTI / EXEC and PUB/SUB contexts.

Do not ask me why I was using 0x (the prefix for hexadecimal notation)
when what we really need here is 0b (the prefix for binary notation).
Really, everything was working by sheer coincidence.

Since 0b has been added in PHP 5.4, we rely on plain decimal numbers
to define our constants for now.
This commit is contained in:
Daniele Alessandri
2012-07-21 13:48:32 +02:00
parent a75e52cf5a
commit 9f51263136
2 changed files with 10 additions and 10 deletions
+4 -4
View File
@@ -30,9 +30,9 @@ class PubSubContext implements \Iterator
const MESSAGE = 'message';
const PMESSAGE = 'pmessage';
const STATUS_VALID = 0x0001;
const STATUS_SUBSCRIBED = 0x0010;
const STATUS_PSUBSCRIBED = 0x0100;
const STATUS_VALID = 1; // 0b0001
const STATUS_SUBSCRIBED = 2; // 0b0010
const STATUS_PSUBSCRIBED = 4; // 0b0100
private $client;
private $position;
@@ -245,7 +245,7 @@ class PubSubContext implements \Iterator
*/
private function invalidate()
{
$this->statusFlags = 0x0000;
$this->statusFlags = 0; // 0b0000;
}
/**
+6 -6
View File
@@ -32,12 +32,12 @@ use Predis\Protocol\ProtocolException;
*/
class MultiExecContext implements BasicClientInterface, ExecutableContextInterface
{
const STATE_RESET = 0x00000;
const STATE_INITIALIZED = 0x00001;
const STATE_INSIDEBLOCK = 0x00010;
const STATE_DISCARDED = 0x00100;
const STATE_CAS = 0x01000;
const STATE_WATCH = 0x10000;
const STATE_RESET = 0; // 0b00000
const STATE_INITIALIZED = 1; // 0b00001
const STATE_INSIDEBLOCK = 2; // 0b00010
const STATE_DISCARDED = 4; // 0b00100
const STATE_CAS = 8; // 0b01000
const STATE_WATCH = 16; // 0b10000
private $state;
private $canWatch;