php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16959 ereg_replace returns wrong characters
Submitted: 2002-05-02 02:25 UTC Modified: 2002-05-21 10:58 UTC
Votes:8
Avg. Score:4.9 ± 0.3
Reproduced:8 of 8 (100.0%)
Same Version:3 (37.5%)
Same OS:1 (12.5%)
From: hirokawa@php.net Assigned:
Status: Closed Package: Regexps related
PHP Version: 4.2.0 OS: Linux and Win2K
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: hirokawa@php.net
New email:
PHP Version: OS:

 

 [2002-05-02 02:25 UTC] hirokawa@php.net
This is small script for testing.
<?php
$pat = "(^|&)foo(&|$)";
$string = "foo";
echo ereg_replace($pat, "\\1", $string);
?>

In PHP <= 4.1.x,  this script returns empty string.
But, PHP 4.2.0 and PHP 4.2.1RC1 return '\1'.
The return value in PHP >= 4.2.0 should be corrected.
ereg_replace() is used for session id propagation in GET mode of PHPlib. It is not work well because
it is affected by this problem.
 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-21 07:04 UTC] tom at scl dot co dot uk
I have had this problem too, I posted a bug report about it on the 24 April and Yohgaki responded asking me to put some code up, I did but he never responded again. I'm supprised that this bug hasn't been fixed because it's a real show stopper for us and it is causing alot of problems because we need some stuff from php 4.2.x but we can't upgrade because all our other code breaks and I imagine there are loads of other people in the same situation.
 [2002-05-21 10:58 UTC] rasmus@php.net
I can't recreate this problem in current HEAD.  I get an empty string returned from this test script so I will assume this is fixed unless you can provide a test script that does the wrong thing in the current code.  See http://snaps.php.net to grab a copy of the current code.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC