Commit 54cb4db0 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #542 in ZP/z-push from...

Merge pull request #542 in ZP/z-push from bugfix/ZP-1229-strict-type-checking-in-syncobject.equals to develop

* commit 'c2be331d':
  ZP-1229 Fixed whitespace.
  ZP-1229  Add new optional parameter to Syncobject.equals() for strict type checking, and undo the global change made to use strict checking introduced by ZP-1088. Released under the Affero GNU General Public License (AGPL) version 3.
parents 2ba15c7e c2be331d
...@@ -267,7 +267,7 @@ class ChangesMemoryWrapper extends HierarchyCache implements IImportChanges, IEx ...@@ -267,7 +267,7 @@ class ChangesMemoryWrapper extends HierarchyCache implements IImportChanges, IEx
// The Zarafa/Kopano HierarchyExporter exports all kinds of changes for folders (e.g. update no. of unread messages in a folder). // The Zarafa/Kopano HierarchyExporter exports all kinds of changes for folders (e.g. update no. of unread messages in a folder).
// These changes are not relevant for the mobiles, as something changes but the relevant displayname and parentid // These changes are not relevant for the mobiles, as something changes but the relevant displayname and parentid
// stay the same. These changes will be dropped and are not sent! // stay the same. These changes will be dropped and are not sent!
if ($folder->equals($this->GetFolder($folder->serverid))) { if ($folder->equals($this->GetFolder($folder->serverid), false, true)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ChangesMemoryWrapper->ImportFolderChange(): Change for folder '%s' will not be sent as modification is not relevant.", $folder->displayname)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ChangesMemoryWrapper->ImportFolderChange(): Change for folder '%s' will not be sent as modification is not relevant.", $folder->displayname));
return false; return false;
} }
......
...@@ -95,9 +95,11 @@ abstract class SyncObject extends Streamer { ...@@ -95,9 +95,11 @@ abstract class SyncObject extends Streamer {
* *
* @see SyncObject * @see SyncObject
* @param SyncObject $odo other SyncObject * @param SyncObject $odo other SyncObject
* @param boolean $log flag to turn on logging
* @param boolean $strictTypeCompare to enforce type matching
* @return boolean * @return boolean
*/ */
public function equals($odo, $log = false) { public function equals($odo, $log = false, $strictTypeCompare = false) {
if ($odo === false) if ($odo === false)
return false; return false;
...@@ -131,9 +133,16 @@ abstract class SyncObject extends Streamer { ...@@ -131,9 +133,16 @@ abstract class SyncObject extends Streamer {
} }
else { else {
if (isset($this->$val) && isset($odo->$val)) { if (isset($this->$val) && isset($odo->$val)) {
if ($this->$val !== $odo->$val){ if ($strictTypeCompare){
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s'", $val, Utils::PrintAsString($this->$val), Utils::PrintAsString($odo->$val))); if ($this->$val !== $odo->$val){
return false; ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s' using strictTypeCompare", $val, Utils::PrintAsString($this->$val), Utils::PrintAsString($odo->$val)));
return false;
}
} else {
if ($this->$val != $odo->$val){
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s'", $val, Utils::PrintAsString($this->$val), Utils::PrintAsString($odo->$val)));
return false;
}
} }
} }
else if (!isset($this->$val) && !isset($odo->$val)) { else if (!isset($this->$val) && !isset($odo->$val)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment