php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50403 nl2br seems to be broken
Submitted: 2009-12-07 22:31 UTC Modified: 2009-12-08 11:12 UTC
From: l dot anzinger at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.11 OS: Debian Squeeze
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: l dot anzinger at gmail dot com
New email:
PHP Version: OS:

 

 [2009-12-07 22:31 UTC] l dot anzinger at gmail dot com
Description:
------------
Using the second parameter of nl2br, as discribed in the docs (http://php.net/nl2br), does not work.

Reproduce code:
---------------
<?php
        echo nl2br("foo\nbar", false);
?>

Expected result:
----------------
foo<br>
bar

Actual result:
--------------
Warning: Wrong parameter count for nl2br() in /var/www/superwayne.org/cron/- on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-08 00:44 UTC] carsten_sttgt at gmx dot de
> Version:	5.2.11
> echo nl2br("foo\nbar", false);
                         ^^^^^
Available as of 5.3.0:
http://www.php.net/nl2br#function.nl2br.changelog

Regards,
Carsten
 [2009-12-08 00:48 UTC] felipe@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

The second parameter was introduced on 5.3 version, as documented in the 'Changelog' section in the documentation.
 [2009-12-08 11:12 UTC] l dot anzinger at gmail dot com
Oh, I'm sorry, I didn't scrolled down to the changelog ...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 03 09:01:26 2025 UTC