iRony CardDAV: ContactsBackend.php does not handle v4 PHOTO properties
Closed, ResolvedPublic


[root@mail CardDAV]# rpm -qv pykolab iRony kolab

Personal use case: Android 6.0 w/ DAVdroid, setting images on contacts

ContactsBackend.php does not handle v4 PHOTO properties, which produces the following error in: /var/log/iRony/errors:

[06-Dec-2016 15:55:16 America/New_York] PHP Fatal error:  Call to a member function getValue() on a non-object in /usr/share/iRony/lib/Kolab/CardDAV/ContactsBackend.php on line 991

I belive the error is due to this code not handling PHOTO:data:image/jpeg;base64, well:

989                 case 'PHOTO':
990                     $param = $prop->offsetGet('encoding') ?: $prop->parameters[0];
991                     if (($pvalue = $param->getValue()) && (strtolower($pvalue) == 'b' || strtolower($pvalue) == 'base     64') || strtolower($param->name) == 'base64') {
992                         $contact['photo'] = $value;
993                     }
994                     break;

PHOTO spec

2.1: PHOTO;JPEG;ENCODING=BASE64:[base64-data]
3.0: PHOTO;TYPE=JPEG;ENCODING=b:[base64-data]
4.0: PHOTO;MEDIATYPE=image/jpeg:
4.0: PHOTO:data:image/jpeg;base64,[base64-data]

Event Timeline

mgoodwin created this task.Dec 6 2016, 10:42 PM
mgoodwin updated the task description. (Show Details)Dec 6 2016, 10:46 PM

My personal workaround was to comment out 989-994 so that the rest of my contacts and properties actually sync.

Roundcube core and kolab_addressbook plugin does not support photo URLs. It is not clear to me if it is at all possible to store URL and mediatype in Kolab XML format (probably only URL without type is supported).

That's why I think it will be fine if we just ignore them and make sure fatal errors are not thrown. In the above list only these two do not cause errors:


I came across this issue yesterday and the above patch appears to fix the problem for me. Please merge it into the iRony repository.