PHP 4.0 Bug #3269: preg_replace is screwed up

From: Date: Fri, 21 Jan 2000 19:40:27 +0000
Subject: PHP 4.0 Bug #3269: preg_replace is screwed up
Groups: php.dev 
Request: Send a blank email to php-dev+get-14808@lists.php.net to get a copy of this message
From: david.kimmel@just.gov.ab.ca Operating system: Solaris 7/SPARC (32-bit) PHP version: 4.0 Beta 3 PHP Bug Type: Misbehaving function Bug description: preg_replace is screwed up Here is the PHP script that caused the problem: <? $regexes = array("/(bold)/i", "/(something)/"); $text = "This is really something to see! A bold new achievement in the world of bugs. Not to mention something that I pr\ obably misspeled there. Woo hoo!"; $new = preg_replace($regexes, "<B>\\1</B>", $text); print $new; ?> That's the entire php file, btw. Under PHP3, this would bold all occurances of the words "bold" and "something". Under PHP4b3 (downloaded about 3 hours before submitting this), it does NOT replace correctly past the first occurance, and it mangles the string in the process. Here is the output: --- This is really <B>something</B> to see! A <B>bold</B> new achievement in the world of bugs. Not to mention <B>y misspel</B> that I probably misspeled there. Woo hoo! --- Ok, this is running PHP4b3 on Solaris 7 5/99, using gcc 2.8.1 downloaded from www.sunfreeware.com. It's running on a really old SparcStation 10, so it's only 32 bit solaris... The configuration command for php4 was: configure --with-xml --enable-trans-sid --with-pgsql --with-apache=../apache_1.3.9 And the only configure options to Apache were first the --prefix=/usr/local/apache, and then after installing php4 into it, --prefix=/usr/local/apache and --activate-module=src/modules/php4/libphp4.a Thanks! -- Dave

« previous php.dev (#14808) next »