6.0.0-alpha14
7/3/25

[#14698] Error in new feature: export of tags as iCal categories
Summary Error in new feature: export of tags as iCal categories
Queue Kronolith
Queue Version 4.2.23
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester wahnes (at) uni-koeln (dot) de
Created 09/26/2017 (2837 days ago)
Due
Updated 10/20/2017 (2813 days ago)
Assigned
Resolved 09/26/2017 (2837 days ago)
Github Issue Link
Github Pull Request
Milestone 4.2.24
Patch Yes

History
10/20/2017 08:34:46 PM Git Commit Comment #6 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 249953f186a43c6f3ee604a10c8dfaa61e470868
Author: Jan Schneider <jan@horde.org>
Date:   Tue, 26 Sep 2017 15:20:29 +0200

[jan] Fix regression in exporting single tags to iCalendar CATEGORIES 
(Bug #14698).

  M docs/CHANGES
  M lib/Event.php
  M package.xml

https://github.com/horde/kronolith/commit/249953f186a43c6f3ee604a10c8dfaa61e470868
09/26/2017 01:53:14 PM Git Commit Comment #5 Reply to this comment
Changes have been made in Git (master):

commit af7efdb22eb6c59fff243eb6626322901cd912a4
Author: Jan Schneider <jan@horde.org>
Date:   Tue Sep 26 15:20:29 2017 +0200

     [jan] Fix regression in exporting single tags to iCalendar 
CATEGORIES (Bug #14698).

  kronolith/docs/CHANGES  | 11 +++++++++++
  kronolith/lib/Event.php |  6 +-----
  kronolith/package.xml   | 15 ++++++++++++++-
  3 files changed, 26 insertions(+), 6 deletions(-)

http://github.com/horde/horde/commit/af7efdb22eb6c59fff243eb6626322901cd912a4
09/26/2017 01:36:37 PM Jan Schneider Comment #4
Assigned to Jan Schneider
State ⇒ Resolved
Milestone ⇒ 4.2.24
Reply to this comment
Fixed even simpler.
09/26/2017 01:36:12 PM Git Commit Comment #3 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 7aca73feb979ef477077335ac283defaa761b6a2
Author: Jan Schneider <jan@horde.org>
Date:   Tue Sep 26 15:20:29 2017 +0200

     [jan] Fix regression in exporting single tags to iCalendar 
CATEGORIES (Bug #14698).

  kronolith/docs/CHANGES  | 2 ++
  kronolith/lib/Event.php | 6 +-----
  kronolith/package.xml   | 4 ++--
  3 files changed, 5 insertions(+), 7 deletions(-)

http://github.com/horde/horde/commit/7aca73feb979ef477077335ac283defaa761b6a2
09/26/2017 11:59:34 AM wahnes (at) uni-koeln (dot) de Comment #2
New Attachment: kronolith-lib-events-ical-export-one-category.patch Download
Reply to this comment
Looks the the patch file did not upload, so I'll try again.
09/26/2017 10:22:26 AM wahnes (at) uni-koeln (dot) de Comment #1
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Error in new feature: export of tags as iCal categories
Queue ⇒ Kronolith
Milestone ⇒
Patch ⇒ Yes
State ⇒ Unconfirmed
Reply to this comment
The new feature introduced in Kronolith 4.2.23 that is supposed to 
allow better access to tags assigned to an event when accessing via 
CalDAV (iCal export) does not work realiably. Tags are supposed to be 
mapped to iCal Categories and in the code of kronolith/lib/Events.php 
there is a special case that handles events that have got exactly one 
tag (or category, for that matter).

When running version 4.2.23 of Kronolith, there will be loads of error 
messages in the log file that read like this when users use CalDAV to 
access Kronolith:

NOTICE: HORDE [kronolith] PHP ERROR: Undefined offset: 0 [pid 12345 on 
line 799 of "[...]/kronolith/lib/Event.php"]

This error is introduced by the fix for bug #14057 or more precisely 
the commit 
https://github.com/horde/horde/commit/72560bfc1e01282cec6e9c8fdbdebfbe39a5809f#diff-89c46998429999e8bfbc8f5d372bf0d0

From my perspective, it looks like there two things wrong with this 
code change:

1. The right parenthesis seems to be at the wrong spot when calling count().
2. The assumption that an array with only one element will have that 
element at position 0 does not hold.

The attached patch does fix the issue at hand in a way, but it does 
this by accessing "$this->_tags" directly instead of using 
"$this->tags" so this is probably not good coding. Unfortunately, I 
don't know how to do it the right way.

The problem with using "$this->tags[0]" as in the current version is 
that the tag/category in the "$_tags" array is not guaranteed to be at 
index 0 of the array. When debugging this and adding a line that reads

Horde::debug($this->tags);

one can see from the debug output that the $this->tags array may look 
like this in practice:

array(1) {
   [242]=>
   string(10) "Geburtstag"
}

array(1) {
   [283]=>
   string(6) "Urlaub"
}

So even though that the array has got exactly one element, there is no 
"$this->tags[0]"

Saved Queries