ID: 11904
Updated by: vlad
Reported By: [EMAIL PROTECTED]
Status: Assigned
Bug Type: Unknown/Other Function
Operating system: 
PHP Version: 4.0.6
Assigned To: derick
Comments:

Before committing it as it is, note that we are not using
<br>, but a <br /> now, and the patch seems to ignore that
fact. Aslo, shouldn't it be <br />\r\n instead for that matter?

Shouldn't we define what 'nl' in 'nl2br()' stands for? \r?
\n? \r\n? If just \n, then no patch needed. If any of the
three, then we need to handle \r\n properly, and also handle
\r somehow (just a bit more code).

Just a thought... I want to be consistent, so mac users
won't be unhappy, like it happened recently...

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

[2001-07-05 10:41:45] [EMAIL PROTECTED]

I'll commit this after I check the patch.

Derick

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

[2001-07-05 08:56:03] [EMAIL PROTECTED]

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 "rn" 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 "rn" 
(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, "rn" would become "rn<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);

  }
  /* }}} */




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



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=11904&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to