summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-06-02 14:44:09 +0200
committerAleksander Machniak <alec@alec.pl>2013-06-02 14:44:09 +0200
commit5df4fe56d509a5c9702506a79f32dcd81d7adc41 (patch)
treef1cb6481d0d27b747aef5c1e1051bb438e18d18f
parenta6b0ca60a431b8e56d7c23246de71978d6968a79 (diff)
Fix backward copat. with cached values serialized but not base64-encoded (#1489142)
-rw-r--r--program/lib/Roundcube/rcube_db.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php
index 645b85adb..2d1e32e24 100644
--- a/program/lib/Roundcube/rcube_db.php
+++ b/program/lib/Roundcube/rcube_db.php
@@ -835,9 +835,14 @@ class rcube_db
*/
public static function decode($input, $serialized = false)
{
+ // use Base64 encoding to workaround issues with invalid
+ // or null characters in serialized string (#1489142)
if ($serialized) {
- // use Base64 encoding to workaround issues with invalid
- // or null characters in serialized string (#1489142)
+ // Keep backward compatybility where base64 wasn't used
+ if (strpos(substr($input, 0, 16), ':') !== false) {
+ return self::decode(@unserialize($input));
+ }
+
return @unserialize(base64_decode($input));
}