Try to fix a lot of regression. Add also more phpunit test to avoid them in future.

This commit is contained in:
Laurent Destailleur
2011-05-01 10:34:18 +00:00
parent 69667f07d0
commit e1e35281f1

View File

@@ -3064,10 +3064,7 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
} }
else else
{ {
$ret=str_replace("\r","",$stringtoencode); $ret=preg_replace('/(\r\n|\r|\n)/i',($forxml?'<br />':'<br>'),$stringtoencode);
$ret=str_replace("\n",($forxml?'<br />':'<br>'),$ret);
//$ret=preg_replace('/(<br>|<br\s*\/>|<br\/>)\s*(\r\n|\r|\n)+/i',($forxml?'<br />':'<br>'),$stringtoencode);
//$ret=preg_replace('/([^<li\s*>]+)(\r\n|\r|\n)+/i',($forxml?'$1<br />':'$1<br>'),$ret);
return $ret; return $ret;
} }
} }