6.0.0-beta1
8/12/25
  • Error
    Ticket 68710 was not found.

[#14018] Kronolith syncml duplicate event detection broken
Summary Kronolith syncml duplicate event detection broken
Queue Synchronization
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester horde (at) albasoft (dot) com
Created 06/19/2015 (3707 days ago)
Due
Updated 06/24/2015 (3702 days ago)
Assigned 06/22/2015 (3704 days ago)
Resolved 06/24/2015 (3702 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
06/24/2015 03:08:32 PM Michael Rubinsky Comment #9
State ⇒ Resolved
Reply to this comment
Fixed, thanks for the analysis.
06/24/2015 03:08:01 PM Git Commit Comment #8 Reply to this comment
Changes have been made in Git (master):

commit 261745cb674115acdd1a67d1fd48d99abd3a7365
Author: horde@albasoft.com <horde@albasoft.com>
Date:   Wed Jun 24 11:06:07 2015 -0400

     Bug: 14018 Fix comparision.

     This was failing if the datetime was equal, but the timezone
     identifier was different.

     Signed-off-by: Michael J Rubinsky <mrubinsk@horde.org>

  kronolith/lib/Api.php |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

http://github.com/horde/horde/commit/261745cb674115acdd1a67d1fd48d99abd3a7365
06/22/2015 02:59:00 PM horde (at) albasoft (dot) com Comment #7 Reply to this comment

[Show Quoted Text - 24 lines]
You are right. Thanks.

But my event test keeps failing, because of a timezone problem, as 
more debug has shown.

I have this setting in my php.ini:
   date.timezone = "Europe/Madrid"
which is a supported setting ( 
http://php.net/manual/en/timezones.europe.php ).

But funambol for thunderbird (Windows desktop) is sending the events 
with another timezone, and if I debug that date comparison in 
kronolith/lib/Api.php  for both date objects, it shows this:

2015-06-22T16:38:50+02:00 WARN: HORDE Caught output:
Horde_Date Object
(
     [_year:protected] => 2015
     [_month:protected] => 6
     [_mday:protected] => 22
     [_hour:protected] => 15
     [_min:protected] => 0
     [_sec:protected] => 0
     [_timezone:protected] => Europe/Paris
     [_defaultFormat:protected] => Y-m-d H:i:s
     [_formatCache:protected] => Array
         (
             [Y-m-d H:i:s] => 2015-06-22 15:00:00
         )

)
Horde_Date Object
(
     [_year:protected] => 2015
     [_month:protected] => 6
     [_mday:protected] => 22
     [_hour:protected] => 15
     [_min:protected] => 0
     [_sec:protected] => 0
     [_timezone:protected] => Europe/Madrid
     [_defaultFormat:protected] => Y-m-d H:i:s
     [_formatCache:protected] => Array
         (
             [Y-m-d H:i:s] => 2015-06-22 15:00:00
         )
)

Timezone are different, but date are equal, as both timezones are 
GMT+1 (+2 right now in summer).
Once the event has been inserted in DB, the second format is used. The 
former is the new event being inserted by funambol.

Thus, comparing them with "==" return false, while using 
compareDateTime function returns true.

Thanks for your time.
06/22/2015 01:10:37 PM Michael Rubinsky Comment #6
State ⇒ Feedback
Reply to this comment
Also, the date object comparison is fine, as it is automagically cast
to string using Horde_Date::__toString().
I have tested it, and it didn't work for me. I have to use 
compareDateTime for it to work.
Please provide a test case where this does not work. I can verify the 
following tests work:

<code>
$d1 = new Horde_Date('2015-06-20');
$d2 = new Horde_Date('2015-06-20');
var_dump($d1 == $d2);
</code>

Results
bool(true)

=========

<code>
$d1 = new Horde_Date('2015-06-20');
$d2 = new Horde_Date('2014-06-20');
var_dump($d1 == $d2);
</code>

Results
bool(false)
Sure it has to be cast to string in that comparison, when both are 
objects and none is a string?
Yes.


06/22/2015 09:10:22 AM horde (at) albasoft (dot) com Comment #5 Reply to this comment
Also, the date object comparison is fine, as it is automagically 
cast to string using Horde_Date::__toString().
I have tested it, and it didn't work for me. I have to use 
compareDateTime for it to work.
Sure it has to be cast to string in that comparison, when both are 
objects and none is a string?
06/20/2015 04:02:33 PM Michael Rubinsky Comment #4
State ⇒ Resolved
Assigned to Michael Rubinsky
Reply to this comment
Tweaked/simplified and committed.

Also, the date object comparison is fine, as it is automagically cast 
to string using Horde_Date::__toString().
06/20/2015 03:55:33 PM Git Commit Comment #3 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 85481894136d7ac88101e9cd265abd29bc3e9d1a
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sat Jun 20 11:52:17 2015 -0400

     Fix iterating search results (Bug #14018).

  kronolith/lib/Api.php |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

http://github.com/horde/horde/commit/85481894136d7ac88101e9cd265abd29bc3e9d1a
06/20/2015 03:53:11 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git (master):

commit c6b60ea5a72e33b2969853dd9a7a520334258d1b
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sat Jun 20 11:52:17 2015 -0400

     Fix iterating search results (Bug #14018).

  kronolith/lib/Api.php |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

http://github.com/horde/horde/commit/c6b60ea5a72e33b2969853dd9a7a520334258d1b
06/19/2015 03:06:33 PM horde (at) albasoft (dot) com Comment #1
Priority ⇒ 1. Low
State ⇒ Unconfirmed
New Attachment: hordewm5-kronolith-EventExists.patch Download
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Synchronization
Summary ⇒ Kronolith syncml duplicate event detection broken
Type ⇒ Bug
Reply to this comment
A broken funambol syncml for Outlook request was creating thousands of 
repeated events in kronolith_events database.

I've found that there is code that could be preventing this, but it's broken.
New events from syncml pass through  "_addiCalEvent" function prior to 
be inserted in database as new events. And there is a search for an 
existing event match in database:
   $result = $driver->search($event);
   // Check if the match really is an exact match:

But $driver->search returns an array of arrays of events, indexed by 
date, while this code will deal with an array of events.
A loop like "foreach ($result as $match)" will have a array of events, 
not a single event. It will never get a match an the event will always 
be inserted as new. In fact, search actually returns thousands of 
duplicated events from my database, but new is inserted anyway.

There's also another bug in this function:
     if ($match->start == $event->start &&
         $match->end == $event->end &&
         $match->title == $event->title &&

is incorrect, as $match->start  is a date object. Should be something like:
     if ($match->start->compareDateTime($event->start) == 0 &&
         $match->end->compareDateTime($event->end) == 0 &&
         $match->title == $event->title &&

Patch is attached to clarify.

Saved Queries