This only fixes reading email addresses so far, and doesn't preserve the
type. I'm not sure what the proper fix is; maybe the cache driver should
expose the data in a different format, but I assume this would have an
impact on the roundcube addressbook implementation.
Details
- Reviewers
- None
- Group Reviewers
Syncroton Developers
Diff Detail
- Repository
- rS syncroton
- Branch
- master
- Lint
Lint Skipped - Unit
No Test Coverage - Build Status
Buildable 53391 Build 18963: arc lint + arc unit
Event Timeline
I think on the reading side the problem is that we get:
array (
'name' => 'Jack Strong',
'firstname' => 'Jack',
'surname' => 'Strong',
'uid' => 'abcdef-0123-4567-89ab-abcdefabc123',
'email:work' =>
array (
0 => 'jack@kolab.org',
),
'etag' => '6d8ce421e9f0111f1437754f5aae04893acc5e59',
'href' => '/dav/addressbooks/user/john@kolab.org/Default/abcdef-0123-4567-89ab-abcdefabc123.vcf',
'folderId' => 'DAV:contact:f7f4db7d320d1fc06786e0b868d6b2a34',
)but the code seems to expect something like:
'email' =>
array (
0 => 'jack@kolab.org',
),So perhaps that's what the driver needs to return? I'm not sure where the TYPE information is supposed to go.
The writing side currently crashes for similar reasons I think (we insert an array where a string would be expected).
The Kolab3 XML objects are read like this:
$emails = $this->obj->emailAddresses(); if ($emails instanceof vectoremail) { $emailtypes = array_flip($this->emailtypes); for ($i = 0; $i < $emails->size(); $i++) { $email = $emails->get($i); $object['email'][] = ['address' => $email->address(), 'type' => $emailtypes[$email->types()]]; } } else { $object['email'] = self::vector2array($emails); }
but Kolab4 vCards are read using rcube_vcard::get_assoc(), so the output is different. We have to support both. And looking at the code it seems that writing is also broken. I can work on this.
| lib/kolab_sync_data_contacts.php | ||
|---|---|---|
| 197 | str_starts_with() requires PHP8. I'm not sure we can do this in Syncroton. Can we? I'm not 100% sure. | |
| lib/kolab_sync_data_contacts.php | ||
|---|---|---|
| 197 | You are right, we currently still try to support php 7.4, so let's stick to that for now. | |