Page MenuHomekolab.org

Fatal error when using CardDAV with OSX client
Closed, ResolvedPublic

Description

PHP Fatal error: __clone method called on non-object in /usr/share/iRony/lib/Kolab/CardDAV/ContactsBackend.php on line 1091.

So, this is iRony-3.1. The bug is in the code used only with Apple clients. I don't know if this is some incompatibility with Sabre/Vobject or a bug in our code. The fatal error should be simply prevented by the following patch:

--- a/lib/Kolab/CardDAV/ContactsBackend.php
+++ b/lib/Kolab/CardDAV/ContactsBackend.php
@@ -1097,7 +1097,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
             // translate custom properties with a matching prefix to labelled items
             foreach ((array)$contact['x-custom'] as $prop) {
                 $name = $prop[0];
-                if (strpos($name, $propname) === 0) {
+                if (strpos($name, $propname) === 0 && $vc->{$name}) {
                     $label = strtolower(substr($name, strlen($propname)+1));
                     $this->_replace_with_labelled_prop($vc, $name, $propname, $label);
                 }

I'd like our iRony expert, Thomas to see this.

Details

Ticket Type
Task

Event Timeline

machniak updated the task description. (Show Details)
machniak raised the priority of this task from to 60.
machniak added projects: iRony, Product Owners.
machniak changed Ticket Type from Task to Task.
machniak added a subscriber: machniak.

The Sabre/VObject is in version 2.1.7, so it should be fine.

Patched the internal webservers, @vincent is testing.

The error remains.

It seems that the error is triggered when hitting REPORT /addressbooks/user%40domain.com/__all__/. Note that the webserver itself nor iRony logs any error anymore.

machniak closed this task as Resolved.EditedMar 21 2016, 11:07 AM
machniak claimed this task.

Fixed the initial issue. I could not find a reproduceable test case, but the fix is really simple and the same check is used few lines before.