1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-18 07:52:21 +01:00

fixed issue #498 another time

seems that the problem was due to the array $this->objects that didn't accept ldap backend ids as key
forced the key to string, seems better now (ldap and local backend tested)
This commit is contained in:
babelouest 2014-05-20 14:53:04 -04:00
parent bb1733da81
commit fed712b0c9

View File

@ -171,11 +171,10 @@ class Addressbook extends AbstractPIMCollection {
);
}
if (!isset($this->objects[$id])) {
if (!isset($this->objects[(string)$id])) {
$contact = $this->backend->getContact($this->getId(), $id);
if ($contact) {
//$this->objects[$id] = new Contact($this, $this->backend, $contact);
$curContact = new Contact($this, $this->backend, $contact);
$this->objects[(string)$id] = new Contact($this, $this->backend, $contact);
} else {
throw new \Exception(
self::$l10n->t('Contact not found'),
@ -185,12 +184,9 @@ class Addressbook extends AbstractPIMCollection {
}
// When requesting a single contact we preparse it
if (isset($curContact)) {
$curContact->retrieve();
$this->objects[$id] = $curContact;
return $curContact;
} else {
return $this->objects[$id];
if (isset($this->objects[(string)$id])) {
$this->objects[(string)$id]->retrieve();
return $this->objects[(string)$id];
}
}