Commit e070d653 authored by Vincent Sherwood's avatar Vincent Sherwood

First check if neither object has the array property set, and if that is the...

First check if neither object has the array property set, and if that is the case log it at debug level and continue with the comparison of other properties.
parent 119acfdc
...@@ -129,8 +129,13 @@ abstract class SyncObject extends Streamer { ...@@ -129,8 +129,13 @@ abstract class SyncObject extends Streamer {
$val = $v[self::STREAMER_VAR]; $val = $v[self::STREAMER_VAR];
// array of values? // array of values?
if (isset($v[self::STREAMER_ARRAY])) { if (isset($v[self::STREAMER_ARRAY])) {
// seek for differences in the arrays // if neither array is created then don't fail the comparison
if (is_array($this->$val) && is_array($odo->$val)) { if (!isset($this->$val) && !isset($odo->$val)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() array '%s' is NOT SET in either object", $val));
continue;
}
elseif (is_array($this->$val) && is_array($odo->$val)) {
// if both arrays exist then seek for differences in the arrays
if (count(array_diff($this->$val, $odo->$val)) + count(array_diff($odo->$val, $this->$val)) > 0) { if (count(array_diff($this->$val, $odo->$val)) + count(array_diff($odo->$val, $this->$val)) > 0) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() items in array '%s' differ", $val)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() items in array '%s' differ", $val));
return false; return false;
......
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