From af560a3f3eba510cc4aee23060c71145c6a58665 Mon Sep 17 00:00:00 2001 From: extead Date: Fri, 2 Aug 2013 11:13:16 +0400 Subject: [PATCH 1/3] Update Json.php Set second parameter to json_encode() with true for return array. Changed decodedValue check condition. --- library/Rediska/Serializer/Adapter/Json.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/Rediska/Serializer/Adapter/Json.php b/library/Rediska/Serializer/Adapter/Json.php index 0a02d91..2b59d47 100644 --- a/library/Rediska/Serializer/Adapter/Json.php +++ b/library/Rediska/Serializer/Adapter/Json.php @@ -83,16 +83,16 @@ public function serialize($value) * Unserialize value * * @param mixed $value - * @return string + * @return array */ public function unserialize($value) { - $decodedValue = json_decode($value); + $decodedValue = json_decode($value, true); - if ($decodedValue === null && $value !== 'null') { + if ($decodedValue === null && $value !== 'null' || !is_array($decodedValue) || json_last_error() != JSON_ERROR_NONE) { throw new Rediska_Serializer_Adapter_Exception("Can't unserialize value"); } - return $value; + return $decodedValue; } -} \ No newline at end of file +} From 182553a99cdc4391d05e0c647cb1b0b52cf7744c Mon Sep 17 00:00:00 2001 From: extead Date: Fri, 2 Aug 2013 11:16:17 +0400 Subject: [PATCH 2/3] Update Json.php --- library/Rediska/Serializer/Adapter/Json.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/Rediska/Serializer/Adapter/Json.php b/library/Rediska/Serializer/Adapter/Json.php index 2b59d47..487854e 100644 --- a/library/Rediska/Serializer/Adapter/Json.php +++ b/library/Rediska/Serializer/Adapter/Json.php @@ -89,10 +89,12 @@ public function unserialize($value) { $decodedValue = json_decode($value, true); - if ($decodedValue === null && $value !== 'null' || !is_array($decodedValue) || json_last_error() != JSON_ERROR_NONE) { + if ($decodedValue === null && $value !== 'null' || json_last_error() != JSON_ERROR_NONE) { throw new Rediska_Serializer_Adapter_Exception("Can't unserialize value"); } - - return $decodedValue; + + if (is_array($decodedValue)) return $decodedValue; + + return $value; } } From b240553c28e169b1db6a33c3b56dc14e5be65fbc Mon Sep 17 00:00:00 2001 From: extead Date: Mon, 20 Jan 2014 10:46:51 +0400 Subject: [PATCH 3/3] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20?= =?UTF-8?q?=D1=81=20Yii?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/Rediska.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/Rediska.php b/library/Rediska.php index eacc1b6..dec232e 100644 --- a/library/Rediska.php +++ b/library/Rediska.php @@ -1,9 +1,12 @@