|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22371 ereg_replace moving ! to start of string
Submitted: 2003-02-22 01:22 UTC Modified: 2003-03-09 18:59 UTC
From: phpbugreport at webfroot dot co dot nz Assigned:
Status: No Feedback Package: Regexps related
PHP Version: 4.3.0 OS: Windows XP
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.
Block user comment
Status: Assign to:
Bug Type:
From: phpbugreport at webfroot dot co dot nz
New email:
PHP Version: OS:


 [2003-02-22 01:22 UTC] phpbugreport at webfroot dot co dot nz
Running Apache 1.3 as a service on Windows XP

$text = ereg_replace ("<a[^>]+href *= *([^ ]+)[^>]*>", "<a href=\\1>", $text);

The above line of code is supposed to find all a tags and strip any attributes except href.  However:

$text = "bacon <a href='' title='hello!'>hello</a>";

will be set to:
bacon !<a href='' title='hello'>hello</a>

How in the hell did that exclaim get to the start of the a tag?  Maybe I'm just doing something wrong, but it looks like a bug to me.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-22 14:15 UTC]
Please try using this CVS snapshot:
For Windows:

With latest CVS I get:
bacon <a href=''>hello</a>
as the result of the regular expression.
 [2003-03-09 18:59 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 04:01:31 2024 UTC