[Fwd: RE: [PHP-DEV] PHP 4.0 Bug #5800: Several things with str_replace()]

From: Date: Thu, 27 Jul 2000 11:09:53 +0000
Subject: [Fwd: RE: [PHP-DEV] PHP 4.0 Bug #5800: Several things with str_replace()]
Groups: php.dev 
Request: Send a blank email to php-dev+get-26459@lists.php.net to get a copy of this message
-------- Original Message -------- Subject: RE: [PHP-DEV] PHP 4.0 Bug #5800: Several things with str_replace() Date: Thu, 27 Jul 2000 12:16:45 +0200 (MEST) From: Yin.Yang@gmx.net To: d.rethans@jdimedia.nl Hello! I'm really sorry for that mistake yesterday, it came from "copy-paste-delete" (it was a awful day yesterday). And also the first described problem isn't caused by str_replace(). The problem is that I get an already corrupted variable from the http-post. Each time the user posts \n, I get instead of x0D0A (\n) x0D0D0A. So str_replace() works right, and I have to check first where this additional x0D is inserted. The bug-report is already closed, so you can forget it. Maybe I can put this too fast acting right in writing some functions (or find some real bug ;-) for the PHP-dev-team, as soon as time permits it. Many thanks for your patient reply! (I hope my acting doesn't prevent you to do the same with others) Best regards, Thomas ----- Original Message ----- From: Derick Rethans <d.rethans@jdimedia.nl> To: <Yin.Yang@gmx.net> Cc: PHP Development List <php-dev@lists.php.net> Sent: Wednesday, July 26, 2000 7:07 PM Subject: Re: [PHP-DEV] PHP 4.0 Bug #5800: Several things with str_replace() > Yin.Yang@gmx.net wrote: > > From: Yin.Yang@gmx.net > Operating system: Win NT 4.0 (ISAPI) > PHP version: 4.0.1pl2 > PHP Bug Type: Scripting Engine problem > Bug description: Several things with str_replace() > > $headlbody = str_replace("\n", "<br>", $headlbody); > $headline1 = "<b>$headlhead</b><br>\n$headlbody<br>\n"; > $fp = fopen("D:\\newsadmin\\headline.txt", w); > .... > makes from "Word1\nWord2\nWord3" > "Word1\n<br>Word2\n<br>Word3". > (mail me for full script and result-file) What's in $headlbody before you do: $headlbody = str_replace("\n", "<br>", $headlbody); ? > > > Due some replies in de.comp.lang.php I tested the following script with the following - amazing - results: > > <? > echo > "<HTML><HEAD><TITLE></TITLE></HEAD><BODY>\n"; > $x = "Word1\nWord2\nWord3\n"; > echo nl2br($x); > echo str_replace("\n", "<br>", $x); > echo "<\n</BODY></HTML>\n"; > ?> > > <HTML><HEAD><TITLE></TITLE></HEAD><BODY> > Word1<br> > Word2<br> > Word3<br> > Word1<br>Word2<br>Word3<br>< file://note the last char! > </BODY></HTML> This is not strange, in your last line you put echo "<\n" which prints that "<" character. -- Derick Rethans JDI Media Solutions H.v.Tussenbroekstraat 1 6952 BL Dieren The Netherlands e-mail: d.rethans@jdimedia.nl http://www.jdimedia.nl/ -- ______________________________________________________________ CCTOP - die C/C++ Programmiergruppe auf http://cctop.cjb.net/ Sent through GMX FreeMail - http://www.gmx.net

« previous php.dev (#26459) next »