|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29486 / causes preg_replace troubles
Submitted: 2004-08-02 01:18 UTC Modified: 2004-08-02 01:24 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: slunta at msn dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.8 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
9 + 22 = ?
Subscribe to this entry?

 [2004-08-02 01:18 UTC] slunta at msn dot com
I don't know why, but a / right before a wildcard is causing a preg replace to stop. I don't believe it's a modifier issue either.

Reproduce code:
$message=isset($_POST['message']) ? htmlentities(trim($_POST['message'])) :'';


$array1[]='/http:\/\/' . $_SERVER['HTTP_HOST'] . '\/(.*)/';
$array2[]='<a href="http://' . $_SERVER['HTTP_HOST'] . '/$1">http://' . $_SERVER['HTTP_HOST'] . '/$1</a>';


Expected result:
In my case, the http host is, and I post

The output is expected to be:

<a href=""></a>

Actual result:
The output I'm really getting is:

<a href=""></a>downloads/index.php


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-02 01:21 UTC] slunta at msn dot com
Please ignore the hyperlinks in the preg_replace code that was automatically created by this bug report page. Treat them as plain text.
 [2004-08-02 01:24 UTC] slunta at msn dot com
Sorry, I got it to work now. It was a modifyer issue >_>. Bug bogus.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 02:01:28 2024 UTC