php.net |  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='http://www.whatever.com' title='hello!'>hello</a>";

will be set to:
bacon !<a href='http://www.whatever.com' 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-22 14:15 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

With latest CVS I get:
bacon <a href='http://www.whatever.com'>hello</a>
as the result of the regular expression.
 [2003-03-09 18:59 UTC] sniper@php.net
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-2019 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 17:01:25 2019 UTC