mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-22 13:58:40 +01:00
replace serialize calls with json_encode;
This commit is contained in:
parent
50baa1af34
commit
4ba4ba0545
@ -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))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user