php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1207 str_replace function cause a segmation fault
Submitted: 1999-03-05 12:11 UTC Modified: 1999-03-13 08:35 UTC
From: skyhi at vipe dot technion dot ac dot il Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.7 OS: Linux
Private report: No CVE-ID: None
 [1999-03-05 12:11 UTC] skyhi at vipe dot technion dot ac dot il
The following code cause a segmation fault:

<?php

$lines = 0;

$fp = fopen("test.txt", "r");

while ($line = fgets($fp, 128)) {

	$line = str_replace("with", "without", $line);
//	$line = ereg_replace("with", "without", $line);
	$lines += 1;
	if (($lines % 100) == 0) {
		echo($lines . " - " . $line . "<BR>\n");
		flush();
	}
}

fclose($fp);

?>

The "text.txt" file was a file with more than 300 lines: "This is a line with a typo". 

When I use "str_replace", then the display only reach 200 (seg. fault), but no problem occurs if I use "ereg_replace".

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-03-13 08:35 UTC] sas
Fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 23:01:32 2024 UTC