From e8de88ac74d9b17a25f7f009fd34741a12d8f144 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 25 May 2018 12:29:36 +0200 Subject: [PATCH] Fix bug where unicode contact names could have been broken/emptied or caused DB errors (#6299) --- CHANGELOG | 1 + program/lib/Roundcube/rcube_addressbook.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 56d81303b4e..8b4f1a3e728 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ CHANGELOG Roundcube Webmail - Fix bug where some escape sequences in html styles could bypass security checks - Fix bug where some forbidden characters on Cyrus-IMAP were not prevented from use in folder names - Fix bug where only attachments with the same name would be ignored on zip download (#6301) +- Fix bug where unicode contact names could have been broken/emptied or caused DB errors (#6299) RELEASE 1.3.6 ------------- diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php index e7d431b7411..8434239c690 100644 --- a/program/lib/Roundcube/rcube_addressbook.php +++ b/program/lib/Roundcube/rcube_addressbook.php @@ -509,7 +509,7 @@ public static function compose_display_name($contact, $full_email = false) // default display name composition according to vcard standard if (!$fn) { $fn = join(' ', array_filter(array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix']))); - $fn = trim(preg_replace('/\s+/', ' ', $fn)); + $fn = trim(preg_replace('/\s+/u', ' ', $fn)); } // use email address part for name @@ -560,7 +560,7 @@ public static function compose_list_name($contact) } $fn = trim($fn, ', '); - $fn = preg_replace('/\s+/', ' ', $fn); + $fn = preg_replace('/\s+/u', ' ', $fn); // fallbacks... if ($fn === '') { @@ -637,8 +637,8 @@ public static function compose_search_name($contact, $email = null, $name = null } } - $result = preg_replace('/\s+/', ' ', $result); - $result = preg_replace('/\s*(<>|\(\)|\[\])/', '', $result); + $result = preg_replace('/\s+/u', ' ', $result); + $result = preg_replace('/\s*(<>|\(\)|\[\])/u', '', $result); $result = trim($result, '/ '); return $result;