1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-30 19:52:17 +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); $contact = $this->backend->getContact($this->getId(), $id);
if ($contact) { if ($contact) {
//$this->objects[$id] = new Contact($this, $this->backend, $contact); $this->objects[(string)$id] = new Contact($this, $this->backend, $contact);
$curContact = new Contact($this, $this->backend, $contact);
} else { } else {
throw new \Exception( throw new \Exception(
self::$l10n->t('Contact not found'), self::$l10n->t('Contact not found'),
@ -185,12 +184,9 @@ class Addressbook extends AbstractPIMCollection {
} }
// When requesting a single contact we preparse it // When requesting a single contact we preparse it
if (isset($curContact)) { if (isset($this->objects[(string)$id])) {
$curContact->retrieve(); $this->objects[(string)$id]->retrieve();
$this->objects[$id] = $curContact; return $this->objects[(string)$id];
return $curContact;
} else {
return $this->objects[$id];
} }
} }