diff --git a/CHANGELOG b/CHANGELOG index 7671d575125..549bdee7ca8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -19,6 +19,7 @@ CHANGELOG Roundcube Webmail - Fix bug where multi-folder search didn't work for unsubscribed INBOX (#5259) - Fix bug where "no body" alert could be displayed when sending mailvelope email - Enigma: Fix keys import from inside of an encrypted message (#5285) +- Fix searching by email address in contacts with multiple addresses (#5291) RELEASE 1.2.0 ------------- diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php index 71549e9938b..f2de8a3313a 100644 --- a/program/lib/Roundcube/rcube_contacts.php +++ b/program/lib/Roundcube/rcube_contacts.php @@ -467,9 +467,10 @@ private function fulltext_sql_where($value, $mode, $col = 'words', $bool = 'AND' foreach ($words as $word) { switch ($mode) { case 1: // strict - $where[] = '(' . $this->db->ilike($col, $word . '%') - . ' OR ' . $this->db->ilike($col, '%' . $WS . $word . $WS . '%') - . ' OR ' . $this->db->ilike($col, '%' . $WS . $word) . ')'; + $where[] = '(' . $this->db->ilike($col, $word) + . ' OR ' . $this->db->ilike($col, $word . $AS . '%') + . ' OR ' . $this->db->ilike($col, '%' . $AS . $word . $AS . '%') + . ' OR ' . $this->db->ilike($col, '%' . $AS . $word) . ')'; break; case 2: // prefix $where[] = '(' . $this->db->ilike($col, $word . '%')