Re: Bug #11904: ext/standard/string.c patch for nl2br()

From: Date: Thu, 05 Jul 2001 14:36:31 +0000
Subject: Re: Bug #11904: ext/standard/string.c patch for nl2br()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-58997@lists.php.net to get a copy of this message
If someone commits this change, please make sure you change his <br> to a <br />. Not sure if that was on purpose or not... Daniel ----- Original Message ----- From: <reaster@comptechnews.com> To: <php-dev@lists.php.net> Sent: Thursday, July 05, 2001 7:56 AM Subject: [PHP-DEV] Bug #11904: ext/standard/string.c patch for nl2br() > From: reaster@comptechnews.com > Operating system: Linux 2.4.6 Slackware > PHP version: 4.0.6 > PHP Bug Type: Unknown/Other Function > Bug description: ext/standard/string.c patch for nl2br() > > I suggest the following patch for string.c to fix the > nl2br() function. > > Instead of replacing "\n" with "<br />\n", I think > "\n<br>" is better. For example, in a string, there might > be a "\r\n" and when nl2br() is applied, it would become > "\r<br />\n". Having a "\r" by itself and not paired with > a "\n" causes problems for me because most programs afaik > expect either just a "\n" (unix systems) or "\r\n" > (microsoft systems) and know how to deal with them. But > when a "\r" is by itself, strange things sometimes happen > and the file will print corrupted. But applying the patch > below, "\r\n" would become "\r\n<br>" which keeps the > carriage return and newline pair intact and adds the > break... unix and windows programs understand the file > still and html renderers don't care about formatting. > > *** string.c.orig Thu Jul 5 08:41:46 2001 > --- string.c Thu Jul 5 08:38:04 2001 > *************** > *** 2511,2517 **** > > convert_to_string_ex(str); > > ! > php_char_to_str((*str)->value.str.val,(*str)->value.str.len,'\n',"<br > />\n",7,return_value); > } > /* }}} */ > > --- 2511,2517 ---- > > convert_to_string_ex(str); > > ! > php_char_to_str((*str)->value.str.val,(*str)->value.str.len,'\n',"\n<br>",5, return_value); > } > /* }}} */ > > > > > > -- > Edit Bug report at: http://bugs.php.net/?id=11904&edit=1 > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.dev (#58997) next »