ID: 34381 Comment by: holliwell at gmx dot net Reported By: jasper at bryant-greene dot name Status: Open Bug Type: Feature/Change Request Operating System: N/A PHP Version: 5.0.4 New Comment:
I second jasper's suggestion of an optional switch, if one wants plain old html 4.01 <br>, default should be xhtml-compliant <br />. Previous Comments: ------------------------------------------------------------------------ [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>> (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