php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bate at bate dot de
New email:
PHP Version: OS:

 

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

$string="Testline1\nTestline2";
echo nl2br($string);

output:
Testlin1
<br />
Testlin2

the <br> are wrong.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

./ext/standart/
-> 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:
php_char_to_str((*str)->value.str.val,(*str)->value.str.len,'\n',"<br>\n",7,return_value);


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

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Aug 11 02:01:24 2020 UTC