From 2eeb2c75df35c8015a2be0727bab16f782063ff5 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 10 Jan 2018 11:52:35 +0100 Subject: [PATCH] Fix bug where contacts search could skip some records (#6130) Conflicts: CHANGELOG --- CHANGELOG | 2 ++ program/lib/Roundcube/rcube_addressbook.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 12f612830..419fd32e4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ CHANGELOG Roundcube Webmail =========================== +- Fix bug where contacts search could skip some records (#6130) + RELEASE 1.3.4 ------------- - Fix a couple of warnings on PHP 7.2 (#6098) diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php index e670214d5..e7d431b74 100644 --- a/program/lib/Roundcube/rcube_addressbook.php +++ b/program/lib/Roundcube/rcube_addressbook.php @@ -654,13 +654,16 @@ abstract class rcube_addressbook */ public static function compose_contact_key($contact, $sort_col) { - $key = $contact[$sort_col] . ':' . $contact['sourceid']; + $key = $contact[$sort_col]; // add email to a key to not skip contacts with the same name (#1488375) if (($email = self::get_col_values('email', $contact, true)) && !empty($email)) { $key .= ':' . implode(':', (array)$email); } + // Make the key really unique (as we e.g. support contacts with no email) + $key .= ':' . $contact['sourceid'] . ':' . $contact['ID']; + return $key; }