From 9f51263136cda0856cef747e614ecb14d3a73a08 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 21 Jul 2012 13:48:32 +0200 Subject: [PATCH] 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. --- lib/Predis/PubSub/PubSubContext.php | 8 ++++---- lib/Predis/Transaction/MultiExecContext.php | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Predis/PubSub/PubSubContext.php b/lib/Predis/PubSub/PubSubContext.php index 45f01423..6eedabd6 100644 --- a/lib/Predis/PubSub/PubSubContext.php +++ b/lib/Predis/PubSub/PubSubContext.php @@ -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; } /** diff --git a/lib/Predis/Transaction/MultiExecContext.php b/lib/Predis/Transaction/MultiExecContext.php index dc7d55df..df8db57f 100644 --- a/lib/Predis/Transaction/MultiExecContext.php +++ b/lib/Predis/Transaction/MultiExecContext.php @@ -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;