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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 17:01:27 2019 UTC