6.0.0-git
2019-03-20

[#8474] All day events cause crash with Funambol outlook connector
Summary All day events cause crash with Funambol outlook connector
Queue Synchronization
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester cocayden+horde (at) gmail (dot) com
Created 2009-08-02 (3517 days ago)
Due
Updated 2009-08-21 (3498 days ago)
Assigned 2009-08-14 (3505 days ago)
Resolved 2009-08-21 (3498 days ago)
Milestone
Patch No

History
2009-08-21 14:55:29 Jan Schneider Comment #23
Assigned to Jan Schneider
State ⇒ Resolved
Reply to this comment
Finally.
2009-08-21 11:27:04 lst_hoe02 (at) kwsoft (dot) de Comment #22 Reply to this comment
Works now without crashing Funambol Outlook Plugin :-)

Maybe we should also add some comment in the source code why we do the 
"mday--" for later readers ot the code?



Many thanks
2009-08-20 15:45:51 Jan Schneider Comment #21 Reply to this comment
What about the following :
I have included the DTSTART case in the getAllAttributes() loop again
to streamline the code and modified the DTEND case to use the same
formating as the DTSTART. The variable "$start" is only used to
compare against "$alarm" as far as i can see and this is working. The
"$end" is only used to compute "Duration" which is no SIF-E attribute
anyway as far as i can see??
No, the $start is also used inside the loop, and we can't guarantee 
that the DTSTART attribute is always before the other attributes that 
depend on it. Beside that, the $start variable had been overwritten 
inside the loop under certain circumstances.
2009-08-20 15:43:08 Jan Schneider Comment #20 Reply to this comment
Undefined index:  value in
/var/www/horde/lib/SyncML/Device/Sync4j.php on line 848
Undefined index:  value in
/var/www/horde/lib/SyncML/Device/Sync4j.php on line 849
Should be fixed now.
2009-08-19 14:30:44 lst_hoe02 (at) kwsoft (dot) de Comment #18 Reply to this comment
What about the following :

I have included the DTSTART case in the getAllAttributes() loop again 
to streamline the code and modified the DTEND case to use the same 
formating as the DTSTART. The variable "$start" is only used to 
compare against "$alarm" as far as i can see and this is working. The 
"$end" is only used to compute "Duration" which is no SIF-E attribute 
anyway as far as i can see??



--- lib/SyncML/Device/Sync4j.php.orig        2009-08-14 17:01:24.000000000 +0200

+++ lib/SyncML/Device/Sync4j.php        2009-08-19 16:26:18.000000000 +0200

@@ -829,7 +829,8 @@

          $hash = array('ReminderSet' => 0,

                        'IsRecurring' => 0,

                        'BusyStatus' => 2);

-        $alarm = null;

+        $alarm = $end = null;

+

          foreach ($content->getAllAttributes() as $item) {

              $GLOBALS['backend']->logMessage(

                  sprintf('Sync4j for name %s, value %s',

@@ -843,18 +844,19 @@

                  if (!empty($item['params']['VALUE']) &&

                      $item['params']['VALUE'] == 'DATE') {

                      $hash['AllDayEvent'] = 1;

-                    $hash['Start'] = sprintf('%04d-%02d-%02dT00:00:00Z',

-                                             $item['value']['year'],

-                                             $item['value']['month'],

-                                             $item['value']['mday']);

+                    $date = new Horde_Date(array('year' => 
$item['value']['year'],

+                                                 'month' => 
$item['value']['month'],

+                                                 'mday' => 
$item['value']['mday']));

+                    $date->correct();

+                    $hash['Start'] = $date->format('Y-m-d');

                      $start = mktime(0, 0, 0,

                                      $item['value']['month'],

                                      $item['value']['mday'],

                                      $item['value']['year']);

                  } else {

                      $hash['AllDayEvent'] = 0;

-                    $hash['Start'] = Horde_iCalendar::_exportDateTime

-                        ($item['value']);

+                    $hash['Start'] = Horde_iCalendar::_exportDateTime(

+                        $item['value']);

                      $start = $item['value'];

                  }

                  break;

@@ -863,10 +865,12 @@

                  if (!empty($item['params']['VALUE']) &&

                      $item['params']['VALUE'] == 'DATE') {

                      $hash['AllDayEvent'] = 1;

-                    $hash['End'] = sprintf('%04d-%02d-%02dT00:00:00Z',

-                                           $item['value']['year'],

-                                           $item['value']['month'],

-                                           $item['value']['mday']);

+                    $date = new Horde_Date(array('year' => 
$item['value']['year'],

+                                                 'month' => 
$item['value']['month'],

+                                                 'mday' => 
$item['value']['mday']));

+                    $date->mday--;

+                    $date->correct();

+                    $hash['End'] = $date->format('Y-m-d');

                      $end = mktime(0, 0, 0,

                                    $item['value']['month'],

                                    $item['value']['mday'],

@@ -983,13 +987,7 @@

                          $hash['DayOfWeekMask'] = $mask;

                      } else {

                          $hash['RecurrenceType'] = 2;

-                        $start = $content->getAttribute('DTSTART');

-                        if (!empty($start['params']['VALUE']) &&

-                            $start['params']['VALUE'] == 'DATE') {

-                            $hash['DayOfMonth'] = $start['value']['mday'];

-                        } else {

-                            $hash['DayOfMonth'] = date('j', $start);

-                        }

+                        $hash['DayOfMonth'] = date('j', $start);

                      }

                      break;


2009-08-19 12:57:07 lst_hoe02 (at) kwsoft (dot) de Comment #17 Reply to this comment
Undefined index:  value in /var/www/horde/lib/SyncML/Device/Sync4j.php 
on line 848

Undefined index:  value in /var/www/horde/lib/SyncML/Device/Sync4j.php 
on line 849



Which means the following lines ...

+                $hash['Start'] = 
Horde_iCalendar::_exportDateTime($start['value']);

+                $start = $start['value'];




2009-08-19 10:45:52 Jan Schneider Comment #16 Reply to this comment
Lead to "Undefined Index: value" and some strange Start Date :
What's the exact error message (line number)?
Why not simply use the same code as for the End-Date as this is
working as it seams???
Because we need the start date at several places.
2009-08-19 09:57:41 lst_hoe02 (at) kwsoft (dot) de Comment #15 Reply to this comment
Hmm



Lead to "Undefined Index: value" and some strange Start Date :



Output converted for client (text/x-s4j-sife):

<?xml 
version="1.0"?><appointment><ReminderSet>0</ReminderSet><IsRecurring>0</IsRecurring><BusyStatus>2</BusyStatus><AllDayEvent>1</AllDayEvent><Start>19700101T000000Z</Start><End>2009-08-19</End><Subject>TEST-1</Subject><Sensitivity>0</Sensitivity></appointment>



Why not simply use the same code as for the End-Date as this is 
working as it seams???
2009-08-18 15:47:59 Jan Schneider Comment #14 Reply to this comment
No idea what I was thinking. Try now?
2009-08-18 14:17:24 lst_hoe02 (at) kwsoft (dot) de Comment #12 Reply to this comment
It does not work



For the lines

+                $hash['Start'] = 
Horde_iCalendar::_exportDateTime($item['value']);

+                $start = $item['value'];



I get a "Undefined variable: item"



and for



+                    $hash['End'] = $date->sprintf('%04d-%02d-%02d');



a "call to undefined method Horde_Date::sprintf()"



in the logfile.



My Horde Version is 3.3.4.
2009-08-18 11:11:22 Jan Schneider Comment #11 Reply to this comment
Thanks, that helps a lot. It's still a serious bug in Funambol that 
really has to be fixed there, but at least we have some hints how to 
work around it now.

Try what I committed.
2009-08-17 11:25:44 lst_hoe02 (at) kwsoft (dot) de Comment #8
New Attachment: bug-8474.zip Download
Reply to this comment
Here are two data.txt debug files with AllDayEvent sync Events.



Outlook-receive-allday.txt lead to crash of the Funambol Outlook Plugin



Outlook-sent-allday.txt is what the same Plugin sent when the event is 
created in Outlook



It seams that the SIF-E does not like full date/times in case of 
AllDayEvent maybe because AllDayEvent means the whole day and not 
lasting 24 hours in Outlook world, so the time part is pointless anyway.

Next in SIF-E Start and End Day have to be the same for a one Day 
event, otherwise it is translated to a two day event as addressed 
Bug#6847.

As the SIF-E is solely to Funambol we could simply hack Sync4j.php to 
follow there "rules", or check version number of the Funambol Plugin 
and use "vcalendar 1.0" instead if the version is >= 7...
2009-08-14 21:28:52 Jan Schneider Comment #7
State ⇒ Feedback
Reply to this comment
Eh, true, I was confused. Can you post a SIF-E event sent from the 
client, that matches the rules of the Kronolith event that causes the 
client to crash?
2009-08-14 20:59:21 lst_hoe02 (at) kwsoft (dot) de Comment #6 Reply to this comment
I thought Horde always send SIF-E if the client is funambol so this 
would be a misshandling of there own format?


2009-08-14 15:39:17 Jan Schneider Comment #5
State ⇒ Not A Bug
Reply to this comment
Please report this to Funambol then.

Unless we did something wrong in the iCalendar implementation (and 
this change was actually required to *fix* a broken implementation), 
there is nothing we could do.
2009-08-14 15:05:33 lst_hoe02 (at) kwsoft (dot) de Comment #4 Reply to this comment
This where the changes which break Funambol/Outlook (Bug #6847)



@@ -840,7 +843,7 @@ class SyncML_Device_sync4j extends SyncM

                  if (!empty($item['params']['VALUE']) &&

                      $item['params']['VALUE'] == 'DATE') {

                      $hash['AllDayEvent'] = 1;

-                    $hash['Start'] = sprintf('%04d-%02d-%02d',

+                    $hash['Start'] = sprintf('%04d-%02d-%02dT00:00:00Z',

                                               $item['value']['year'],

                                               $item['value']['month'],

                                               $item['value']['mday']);

@@ -858,9 +861,9 @@ class SyncML_Device_sync4j extends SyncM



              case 'DTEND':

                  if (!empty($item['params']['VALUE']) &&

-                    $item['params']['VALUE'] == "DATE") {

+                    $item['params']['VALUE'] == 'DATE') {

                      $hash['AllDayEvent'] = 1;

-                    $hash['End'] = sprintf('%04d-%02d-%02d',

+                    $hash['End'] = sprintf('%04d-%02d-%02dT00:00:00Z',



Seams Funambol does not like too many zeros :-(


2009-08-14 14:50:24 lst_hoe02 (at) kwsoft (dot) de Comment #3 Reply to this comment
This was introduced with the latest changes in Horde for 3.3.4 / 
SyncML. The Plugin crashes with the "send report to MS" message and 
that's it. It occurs as soon as a reccuring event should be synced 
with all versions of the Outlook Funambol Plugin up to 8.0.4
2009-08-03 15:33:00 Jan Schneider Comment #2
State ⇒ Feedback
Milestone ⇒
Reply to this comment
What do you mean with "crashes" and how is this a bug in Horde?
2009-08-02 02:30:57 cocayden+horde (at) gmail (dot) com Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ All day events cause crash with Funambol outlook connector
Queue ⇒ Synchronization
Milestone ⇒ Webmail edition 1.2.3
Patch ⇒ No
Reply to this comment
Funambol crashes when receiving events that last from 00:00 to 00:00 
the next day from horde.

The events are usually public holidays(New Years Day etc) that are 
automatically added by outlook.

The events when export to csv look like

New Year's Day        Holiday        Australia                        1/01/2008        0:00:00        2/01/2008        0:00:00        0

This occurs for recurring events as well.

I am running centos 5.3 with horde webmail edition 1.2.3. Using 
Funambol outlook connector 7.2.



The debug information from /tmp/sync/log.txt for an event is below:

DEBUG:  Sync4j for name DTSTAMP, value 1248955555

DEBUG:  Sync4j for name CREATED, value 1248955444

DEBUG:  Sync4j for name LAST-MODIFIED, value 1248502388

DEBUG:  Sync4j for name SUMMARY, value New Year's Day

DEBUG:  Sync4j for name ORGANIZER, value mailto:xxx@xxx.com

DEBUG:  Sync4j for name CATEGORIES, value Holiday

DEBUG:  Sync4j for name LOCATION, value Australia

DEBUG:  Sync4j for name CLASS, value PUBLIC

DEBUG:  Sync4j for name STATUS, value CONFIRMED

DEBUG:  Sync4j for name TRANSP, value OPAQUE

DEBUG:  Created device class SyncML_Device_Sync4j

DEBUG:  Sending add from server: 
040000008200E00074C5B7101A82E00800000000705EEB086CEEC701000000000000000010000000122B51157EE4734EA7DC47716CD028AC

DEBUG:  Sync4j for name DTSTART, value array (

   'year' => '2008',

   'month' => '01',

   'mday' => '01',

)

DEBUG:  Sync4j for name DTEND, value array (

   'year' => '2008',

   'month' => '01',

   'mday' => '02',

)


Saved Queries