[kronolith] Problem accessing external .ics file
Carsten Schumann
grypho at tempus-vivit.net
Wed Sep 14 12:06:35 UTC 2011
I traced down the error issue. It's not a bug of horde but a bug of
groupwise. In the .ics file one event has two DTSTART tags within one
VEVENT (which is not compliant with RFC5545). When horde queries the
start of the event by calling $vEvent->getAttribute('DTSTART'); in
kronolith/lib/Event.php:961 an array of both DTSTART tags is being
returned and intepreted as an date array.
Because neither year nor month is defined within that array, a
subsequent call to the correct month function subtracts 1 from the year
resulting in the date year=-1, month=12, day=0 and the correct date /
start of month functions change it to year=-1, month=11, day=1 which we
can see below in the error message.
Allthough it is not a bug of horde, it would be cool if horde could
catch the issue duplicate one-time-tags such as DTSTART,DTEND and UID.
In my code I did a dirty bugfix
in kronolith/lib/Event.php:863
try {
$uid = $vEvent->getAttribute('UID');
+ if(is_array($uid))
+ $uid = $uid[0];
if (!empty($uid)) {
$this->uid = $uid;
}
and kronolith/lib/Event.php:954
// Start and end date.
try {
$start = $vEvent->getAttribute('DTSTART');
+ if(is_array($start) && !array_key_exists('year',$start))
+ $start = $start[0];
if (!is_array($start)) {
// Date-Time field
$this->start = new Horde_Date($start);
} else {
// Date field
$this->start = new Horde_Date(
array('year' => (int)$start['year'],
'month' => (int)$start['month'],
'mday' => (int)$start['mday']));
}
} catch (Horde_Icalendar_Exception $e) {}
try {
$end = $vEvent->getAttribute('DTEND');
+ if(is_array($end) && !array_key_exists('year',$end))
+ $end = $end[0];
if (!is_array($end)) {
// Date-Time field
which works fine with all my Groupwise .ics files.
Carsten
On Wed, 14 Sep 2011 11:25:54 +0200, Jan Schneider wrote:
> Zitat von Carsten Schumann <grypho at tempus-vivit.net>:
>
>> Hi guys,
>>
>> I'm trying to display an ICAL .ics file in Kronolith. While
>> Kronolith 2.3.1 works fine and displays all my external calendar
>> items, Kronolith 3.0.8 shows up with an error:
>>
>> DateTime::__construct() [<a
>> href='datetime.--construct'>datetime.--construct</a>]: Failed to
>> parse time string (-001-11-01) at position 7 (-): Double timezone
>> specification
>>
>> The ICAL file(~1MB) was generated by Novell Groupwise and works fine
>> with all my other clients except Kronolith 3.0.8.
>>
>> Any ideas/suggestions to solve the issue or to track down the bug?
>
> Try to import that file instead. Try to track this down to a single
> event.
>
> Jan.
>
> --
> Do you need professional PHP or Horde consulting?
> http://horde.org/consulting/
More information about the kronolith
mailing list