diff --git a/mail/inc/class.mail_activesync.inc.php b/mail/inc/class.mail_activesync.inc.php index 4cec1e1d78..fbf795afdd 100644 --- a/mail/inc/class.mail_activesync.inc.php +++ b/mail/inc/class.mail_activesync.inc.php @@ -2165,7 +2165,13 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send if (file_exists($file = $this->hashFile()) && ($hashes = file_get_contents($file))) { - $this->folderHashes = unserialize($hashes); + $this->folderHashes = json_decode($hashes,true); + // fallback in case hashes have been serialized instead of being json-encoded + if (json_last_error()!=JSON_ERROR_NONE) + { + //error_log(__METHOD__.__LINE__." error decoding with json"); + $this->folderHashes = unserialize($hashes); + } } else { @@ -2180,7 +2186,8 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send */ private function storeFolderHashes() { - return file_put_contents($this->hashFile(), serialize($this->folderHashes)); + // make sure $this->folderHashes is an array otherwise json_encode may fail on decode for string,integer,float or boolean + return file_put_contents($this->hashFile(), json_encode((is_array($this->folderHashes)?$this->folderHashes:array($this->folderHashes)))); } /** diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 4daf126cf1..021073e520 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -89,7 +89,6 @@ class mail_compose if (is_null(mail_bo::$mailConfig)) mail_bo::$mailConfig = config::read('mail'); $this->mailPreferences =& $this->mail_bo->mailPreferences; - } /** @@ -1776,9 +1775,6 @@ class mail_compose 'tmp_name' => $tmpFileName, 'size' => $_formData['size'] ); - // trying different ID-ing Method, as getRandomString seems to produce non Random String on certain systems. - //$attachmentID = md5(time().serialize($buffer)); - //error_log(__METHOD__." add Attachment with ID:".$attachmentID." (md5 of serialized array)"); if (!is_array($_content['attachments'])) $_content['attachments']=array(); $_content['attachments'][] = $buffer; unset($buffer);