Skip to content

Commit

Permalink
Fix bug where unicode contact names could have been broken/emptied or…
Browse files Browse the repository at this point in the history
… caused DB errors (#6299)
  • Loading branch information
alecpl committed May 25, 2018
1 parent 53f9394 commit e8de88a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------
Expand Down
8 changes: 4 additions & 4 deletions program/lib/Roundcube/rcube_addressbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 === '') {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e8de88a

Please sign in to comment.