php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36560 [chm] bug on function.str-replace.html
Submitted: 2006-02-28 16:50 UTC Modified: 2006-02-28 18:07 UTC
From: gruja at phy dot bg dot ac dot yu Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.1.2 OS: windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gruja at phy dot bg dot ac dot yu
New email:
PHP Version: OS:

 

 [2006-02-28 16:50 UTC] gruja at phy dot bg dot ac dot yu
Description:
------------
I have found a bug on page function.str-replace.html
[chm date: 2005-05-20]...

When I wish to replace new line character it does insert instead.


Reproduce code:
---------------
$string="aaa
bbb";
$string=str_replace("\n", "<br>", $string);
print $string;

Expected result:
----------------
aaa<br>bbb

Actual result:
--------------
aaa
<br>bbb

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-28 17:03 UTC] bjori@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Windows uses \r\n not \n
 [2006-02-28 18:07 UTC] gruja at phy dot bg dot ac dot yu
I have tested similar code on bouth windows and unix. Production server is unix, and I use windows machine for developing applications. I have seen this bug first time on unix, and then again at my PC. 
Actualy I read string from MySQL, then try to remove \n (beacose it shold be all writen in one line for javascript) and to replace it with <br>...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC