From 39ded96964b647eca9798019bdee83b826bd58f1 Mon Sep 17 00:00:00 2001 From: Guillaume Lafarge Date: Wed, 4 Dec 2013 17:42:32 +0100 Subject: [PATCH] Fix newline trim When using with
format it now allows for 'b' and 'r' chars at the end of last line. I think rtrim is not suitable when used with a word rather than a charlist. --- classes/AddressFormat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/AddressFormat.php b/classes/AddressFormat.php index bf288096f..18cdc91de 100644 --- a/classes/AddressFormat.php +++ b/classes/AddressFormat.php @@ -379,7 +379,7 @@ class AddressFormatCore extends ObjectModel $addressText .= (!empty($tmpText)) ? $tmpText.$newLine: ''; } - $addressText = rtrim($addressText, $newLine); + $addressText = preg_replace('/'.preg_quote($newLine,'/').'$/i', '', $addressText); $addressText = rtrim($addressText, $separator); return $addressText;