|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17957 Empty backreferences broken
Submitted: 2002-06-24 18:08 UTC Modified: 2002-09-24 11:42 UTC
From: john at scl dot co dot uk Assigned:
Status: Closed Package: Regexps related
PHP Version: 4.3.0-dev OS: Linux 2.2.19
Private report: No CVE-ID:
 [2002-06-24 18:08 UTC] john at scl dot co dot uk

echo ereg_replace("^(a*)",'\1','a')."\n";
echo ereg_replace("^(a*)",'\1','b')."\n";

echo ereg_replace("^(a)*",'\1','a')."\n";
echo ereg_replace("^(a)*",'\1','b')."\n";



should produce:

'./configure' '--with-apxs=/usr/sbin/apxs' '--with-config-file-path=/usr/lib' '--with-curl'
'--with-pdflib=shared' '--with-mcrypt' '--with-pcre' '--with-dom' '--with-pear' '--with-xml=shared' '--with-zlib-dir=/usr' '--prefix=/usr' '--enable-debug=no' '--enable-safe-mode' '--with-exec-dir=/usr/bin' '--with-mysql=/usr' '--with-regex=system'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-25 07:02 UTC]
Can you try the latest snapshot from, I think this has been fixed.
 [2002-07-09 06:34 UTC] john at scl dot co dot uk
Tried it with 4.3.0-dev downloaded from CVS this morning
and result is same. (Not sure if this is same as
 [2002-07-09 08:04 UTC]

 [2002-09-24 11:42 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 15:01:33 2015 UTC