php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19922 nl2br() fails for not empty strings without newline.
Submitted: 2002-10-15 12:44 UTC Modified: 2002-10-15 14:22 UTC
From: andreas dot rieber at 2e-systems dot com Assigned:
Status: Closed Package: Strings related
PHP Version: 4.3.0-pre1 OS: FreeBSD
Private report: No CVE-ID: None
 [2002-10-15 12:44 UTC] andreas dot rieber at 2e-systems dot com
The nl2br() function output is messed up, if the string is not empty but has no newline.

testfile:
-----------------------------------------------------
--TEST--
Testing nl2br()
--FILE--
<?php 

$stringa = "without newline";
$stringb = "with\nnewline";

echo nl2br( $stringa), "\n";
echo nl2br( $stringb), "\n";

?>
--EXPECT--
without newline
with
newline

log of test:
-----------------------------------------------------

---- EXPECTED OUTPUT
without newline
with
newline
---- ACTUAL OUTPUT
A ...(binay data can't copy :-)
with<br />
newline
---- FAILED


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-15 12:53 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2002-10-15 13:22 UTC] nicos@php.net
This bug is verified if there is no such \n it outputs something strange not even ISO.
 [2002-10-15 14:22 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

This was fixed several days ago.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 20:01:29 2024 UTC