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:46:51 +0200
commitab05ee25c1d38c884790337796f7c941e28d36d9 (patch)
tree5fe44b1d376630e7d08fbd7b68912d3fc1e390e7
parent72c8504b99fbd423651bab0180a044c489ca05cc (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 adfe3ca3c..b3f549b23 100644
--- a/program/lib/Roundcube/rcube_db.php
+++ b/program/lib/Roundcube/rcube_db.php
@@ -829,9 +829,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));
}