str_replace() broken in 4.2.1 (Apache 1.3.26/Linux 2.2)

From: Date: Fri, 19 Jul 2002 22:06:16 +0000
Subject: str_replace() broken in 4.2.1 (Apache 1.3.26/Linux 2.2)
Groups: php.general 
Request: Send a blank email to php-general+get-108588@lists.php.net to get a copy of this message
In PHP 4.2.1 (stock php.ini) under Linux (RedHat 6.1) using Apache 1.3.26 the following code: $source = 'TEXT'; $replace = '<tag attribute=\"1\"><tag attribute=\"blah\">'; $template = '<attribute="TEXT">'; $expandedStr = str_replace( $source, $replace, $template ); print( "<h1>Result is: '$expandedStr'</h1>" ); Yields the incorrect result: <h1>Result is: '<attribute="<tag attribute="1><tag attribute="blah">">'</h1> Note the missing ". However, if the <> are removed from $template then the result becomes: <h1>Result is: 'attribute="<tag attribute=\"1\"><tag attribute=\"blah\">"'</h1> which in this context is correct. I've filed a bug report but wanted to ask if anyone else has seen this? -- Yermo ---------------------------------------------------------------------
DTLink Consulting                        http://consulting.dtlink.com
        Linux Software Engineering and Consulting Services
---------------------------------------------------------------------

« previous php.general (#108588) next »