|  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Tue Apr 23 06:01:30 2024 UTC