php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2690 repeated operations on a character array (string) cause php to segfault
Submitted: 1999-11-09 14:59 UTC Modified: 1999-11-13 13:37 UTC
From: jmat at firewind dot net Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0 Latest CVS (09/11/1999) OS: Linux
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: jmat at firewind dot net
New email:
PHP Version: OS:

 

 [1999-11-09 14:59 UTC] jmat at firewind dot net
I upgraded my 11/01/99 CVS build with the RC4 build (totally starting over from scratch), and started having some very strange problems when I started manipulating strings.  Basically I have a string that is used for 'flags', (i.e. position 1 has a flag of A, position 2 B, etc.).  Normally, I change these flags from a webpage by recursing through an array and changing individual characters.... but suddenly it stopped working, and has started segmentation faulting ... here's a code segment of the problem code:

$inarray = array(1=>"A",2=>"B",3=>"C"); // etc...

$string = "A--DF--S--DS---C";

while (list($key,$val) = each($inarray)) {
       echo "PRE: $string<br>";
        $string[$key] = $val;
       echo "POST: $string<p>";
}

...

this works for about 2 iterations, then we have major memory munging, and $string turns into a bunch of garbage.. (even a Yen symbol or three) after 2 more iterations, the Apache child process dies.

I tried doing a few different things, including converting $string to an array first, then doing a individual element replace... but then I discovered that a reset($inarray) also segfaulted things.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-13 13:37 UTC] thies at cvs dot php dot net
fixed in CVS by andi
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Feb 15 15:00:01 2026 UTC