PHP 4.0 Bug #8390 Updated: nl2br generates bad tag

From: Date: Thu, 28 Dec 2000 01:03:09 +0000
Subject: PHP 4.0 Bug #8390 Updated: nl2br generates bad tag
Groups: php.dev 
Request: Send a blank email to php-dev+get-42349@lists.php.net to get a copy of this message
ID: 8390 Updated by: jon Reported By: anil@recoil.org Old-Status: Open Status: Closed Bug Type: Feature/Change Request Assigned To: Comments: Patch committed. Previous Comments: --------------------------------------------------------------------------- [2000-12-23 18:49:15] anil@recoil.org Right now, it's impossible to generate valid XHTML by using the nl2br() command, as it outputs a <br> tag. It would be nice to change this to output a <br /> tag instead, which is fully backward compatible afaik, and also valid XML (and hence XHTML). Here's an extremely complicated patch that should hopefully accomplish this :-) --- ext/standard/string.c.orig Sat Dec 23 23:39:06 2000 +++ ext/standard/string.c Sat Dec 23 23:40:48 2000 @@ -2304,7 +2304,7 @@ PHP_FUNCTION(nl2br) convert_to_string_ex(str); - php_char_to_str((*str)->value.str.val,(*str)->value.str.len,'n',"<br>n",5,return_value); + php_char_to_str((*str)->value.str.val,(*str)->value.str.len,'n',"<br />n",7,return_value); } /* }}} */ --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8390

« previous php.dev (#42349) next »