6.0.0-git
2020-06-03

[#14945] CardDAV: Removing property values is broken
Summary CardDAV: Removing property values is broken
Queue Turba
Queue Version FRAMEWORK_5_2
Type Bug
State Duplicate
Priority 2. Medium
Owners
Requester bugs.horde.org (at) ulle (dot) dyndns (dot) org
Created 2019-08-20 (288 days ago)
Due
Updated 2019-10-09 (238 days ago)
Assigned
Resolved 2019-10-08 (239 days ago)
Milestone
Patch No

History
2019-10-09 10:30:58 bugs (dot) horde (dot) org (at) ulle (dot) dyndns (dot) org Comment #3 Reply to this comment
This has been discussed in #12516 already.
Thanks for taking care of this report. And pointing me to #12516 which 
is duplicate indeed. I might have used the search page wrongly ...
2019-10-08 13:48:02 Jan Schneider State ⇒ Duplicate
 
2019-10-04 19:10:42 wahnes (at) uni-koeln (dot) de Comment #2 Reply to this comment
Horde does not remove this (not sent) property . It just keeps its 
former value.
That means it is impossible to remove property values via CardDAV.
Removing properties via Horde web frontend or ActiveSync works as expected.
This has been discussed in #12516 already.

Since Horde only exposes some of the values that are stored in the 
database via CardDAV, but not all of them, care needs to be taken not 
to unset values that cannot be set via CardDAV.
2019-08-20 13:19:27 bugs (dot) horde (dot) org (at) ulle (dot) dyndns (dot) org Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ CardDAV: Removing property values is broken
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ No
Reply to this comment
When a CardDAV client wants to change a property of an address book 
entry, it just sends the new property value. Along with all other 
properties of this entry, which _have a value_ (no matter if changed 
or not). This works well with Horde.

If the clients wants to _remove_ a property , the client just does not 
send it. Instead it sends all other properties of the entry, which 
_have a value_ (no matter if changed or not).

Horde does not remove this (not sent) property . It just keeps its 
former value.
That means it is impossible to remove property values via CardDAV.
Removing properties via Horde web frontend or ActiveSync works as expected.

This misbeavior is coming from function davPutObject($collection, 
$object, $data)
in turba/lib/Application.php
https://github.com/horde/turba/blob/master/lib/Application.php#L1107
Horde only changes properties sent by CardDAV client , unsent 
properties just stay within the former existing object, which then get 
stored to database.

My suggestion for improvement:

Putting these lines before foreach ($contact as $attribute => $value) 
{ (between line 1104 and line 1105)

                 // Set every property to null (except those starting 
with '__')
                 foreach ($existing_contact->attributes as $attribute 
=> $value) {
                     if ( strpos($attribute, '__') !== 0 ) {
                         $existing_contact->setValue($attribute, null );
                     }
                 }
                 // tags/categories should not be null, but empty string
                 $existing_contact->setValue( '__tags' , '' );

Looking forward to seeing this fixed.

Saved Queries