Bug #70320 [Opn->Nab]: nl2br() behavior with \n\r

From: Date: Fri, 21 Aug 2015 14:48:38 +0000
Subject: Bug #70320 [Opn->Nab]: nl2br() behavior with \n\r
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195404@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70320&edit=1 ID: 70320 Updated by: cmb@php.net Reported by: justcoding at outlook dot com Summary: nl2br() behavior with \n\r -Status: Open +Status: Not a bug Type: Bug Package: Strings related Operating System: Windows 7 64 Bit PHP Version: 7.0.0RC1 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: 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 \r\n is a single Windows style linebreak. \n\r are two linebreaks (Unix style + old MacOS style). Previous Comments: ------------------------------------------------------------------------ [2015-08-21 14:07:45] justcoding at outlook dot com Description: ------------ The function nl2br() have a problem with strings, that have a \n\r inside. It returns a newline and a HTML line break for that. But the behavior of nl2br() with \r\n is different. It returns only a HTML line break for that. Test script: --------------- echo nl2br("This\r\nis\n\ra\nstring\r"); Expected result: ---------------- This<br /> is<br /> a<br /> string<br /> Actual result: -------------- This<br /> is<br /> a<br /> string<br /> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70320&edit=1

« previous php.bugs (#195404) next »