2
0
forked from Wavyzz/dolibarr

Fix: Error with php 5.2

This commit is contained in:
Laurent Destailleur
2010-09-04 13:11:57 +00:00
parent 2368cc676e
commit adf167436e

View File

@@ -2871,9 +2871,13 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1)
* @return string String encoded * @return string String encoded
*/ */
function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false) function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
{
if (! $nl2brmode)
{ {
// We use @ to avoid warning on PHP4 that does not support entity encoding from UTF8; // We use @ to avoid warning on PHP4 that does not support entity encoding from UTF8;
if (! $nl2brmode) return @nl2br($stringtoencode,$forxml); if (version_compare(PHP_VERSION, '5.3.0') < 0) return @nl2br($stringtoencode);
else return @nl2br($stringtoencode,$forxml);
}
else else
{ {
$ret=str_replace("\r","",$stringtoencode); $ret=str_replace("\r","",$stringtoencode);