|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11347 nl2br works not correctly
Submitted: 2001-06-08 02:05 UTC Modified: 2001-06-08 14:09 UTC
From: bate at bate dot de Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.0.5 OS: Linux/FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
34 - 30 = ?
Subscribe to this entry?

 [2001-06-08 02:05 UTC] bate at bate dot de
The function nl2br
works not correct:

echo nl2br($string);

<br />

the <br> are wrong.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-08 02:48 UTC] bate at bate dot de
I checked the Source and found the Problem:

-> string.c
Line 2512:
php_char_to_str((*str)->value.str.val,(*str)->value.str.len,'\n',"<br />\n",7,return_value);

Correct this please to
Line 2512:

 [2001-06-08 14:09 UTC]
This is not bug. nl2br() is now xHTML compliant.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Sep 24 11:01:25 2023 UTC