ID:               34381
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jasper at bryant-greene dot name
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
 Operating System: N/A
 PHP Version:      5.0.4
-Assigned To:      
+Assigned To:      kalle
 New Comment:

This feature has been implemented and is available as of PHP 5.3


Previous Comments:
------------------------------------------------------------------------

[2008-08-07 01:30:50] [EMAIL PROTECTED]

Try this patch (for PHP_5_3 cvs):
http://www.phpfi.com/340833

This adds a new parameter to nl2br() to enable nl2br() to return "<br>"
insted of "<br />"

------------------------------------------------------------------------

[2008-03-13 15:28:15] holliwell at gmx dot net

I second jasper's suggestion of an optional switch, if one wants plain
old html 4.01 <br>, default should be xhtml-compliant <br />.

------------------------------------------------------------------------

[2007-10-25 17:25:29] nospam at wanted dot by dot me

That <br /> tags generated by the NL2BR() function are not compliant
with an HTML 4.01 DOCTYPE is now commented on otherwise legitimate pages
by the W3C validator.

I fail to understand why a new function wasn't invented to handle
output intended for XHTML instead of simply amending this function
intended for HTML output as of PHP 4.0.5 onwards -  did you assume that
everyone would immediately migrate to XHTML at that time?

The only alternative for PHP authors who wish to generate HTML
compliant markup at present are left with is to write their own version
of NL2BR() and replace it's use throughout their script bases and
libraries when generating HTML.

A solution PHP could offer is a new function that enables PHP authors
to specify whether an HTML page is being output or whether it is
something else, like XHTML or XML. This function (or method) could be
invoked at the same time as the DOCTYPE is output. It could also be
defaulted by a php.ini switch quite handily.

------------------------------------------------------------------------

[2005-09-05 22:56:35] jasper at bryant-greene dot name

Description:
------------
The nl2br() function, as of PHP 4.0.5, always inserts <br />. However,
in HTML a complaint parser should understand this as <br>&gt; (it is the
SGML SHORTTAG syntax).

For example, this code:

| <p>This is<br />a paragraph</p>

should be rendered as this in an HTML document[1]:

| This is
| >a paragraph

Therefore, in order to maintain compatibility with both HTML and XHTML
specifications, I request that an option be added to nl2br() that allows
XHTML or HTML compliant br elements to be inserted.

[1] for more information, see http://hixie.ch/advocacy/xhtml



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34381&edit=1

Reply via email to