#18677 [Csd]: Bug in trim() function

From: Date: Fri, 02 Aug 2002 09:10:56 +0000
Subject: #18677 [Csd]: Bug in trim() function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15794@lists.php.net to get a copy of this message
ID: 18677 Updated by: hholzgra@php.net Reported By: ghort@email.cz Status: Closed Bug Type: Unknown/Other Function Operating System: WindowsXP PHP Version: 4.1.2 New Comment: the additional \r in front of the <br /> tag is fixed in 4.2.x if you are expecting all \r\n's removed then you are wrong, nl2br only adds <br /> tags, original line brakes will stay for HTML source readability, and trim() will only remove the \r\n at the end of the string, not within ... Previous Comments: ------------------------------------------------------------------------ [2002-07-31 17:49:00] kalowsky@php.net Unable to reproduce on CVS head on Win2k, and OSX. Upgrade to newer version and if it still fails, reopen the bug. ------------------------------------------------------------------------ [2002-07-31 14:21:38] ghort@email.cz In HEX the result of that script is: 31 2E 6C 69 6E 65 0D 3C 62 72 20 2F 3E 0D 0A 32 2E 6C 69 6E 65 0D 3C 62 72 20 2F 3E 0D 0A 32 2E 6C 69 6E 65 I hope it's usefull ;o) Ghort* ------------------------------------------------------------------------ [2002-07-31 14:13:39] ghort@email.cz Hi! I have perhaps found a bug in trim() function. I have following script: $text = nl2br($text); $text = trim($text) The $text variable content ends of line (Unix "\n" or Windows "\r\n"). For example "1.line\r\n2.line\r\n3.line". But the result of the script above is "1.radek\r<br />\r\n2.radek\r<br />\r\n3.radek" instead of "1.radek<br />2.radek<br />3.radek". It is my mistake, or bug of trim() function...? Thanx for answer, Ghort* ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18677&edit=1

« previous php.bugs (#15794) next »