diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c23c14aecee..6395bd77d34 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3629,14 +3629,10 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8') */ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false) { - if (! $nl2brmode) - { - if (version_compare(PHP_VERSION, '5.3.0') < 0) return nl2br($stringtoencode); - else return nl2br($stringtoencode,$forxml); - } - else - { - $ret=preg_replace('/(\r\n|\r|\n)/i',($forxml?'
':'
'),$stringtoencode); + if (!$nl2brmode) { + return nl2br($stringtoencode, $forxml); + } else { + $ret=preg_replace('/(\r\n|\r|\n)/i', ($forxml?'
':'
'), $stringtoencode); return $ret; } }