php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3269 preg_replace is screwed up
Submitted: 2000-01-21 14:40 UTC Modified: 2000-01-27 09:58 UTC
From: david dot kimmel at just dot gov dot ab dot ca Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Beta 3 OS: Solaris 7/SPARC (32-bit)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: david dot kimmel at just dot gov dot ab dot ca
New email:
PHP Version: OS:

 

 [2000-01-21 14:40 UTC] david dot kimmel at just dot gov dot ab dot ca
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-01-27 09:58 UTC] andrei at cvs dot php dot net
This is a known bug that has been fixed for Beta 4.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 11:01:32 2025 UTC