#44145 [NEW]: preg_replace using the e modifier problem
| From: | phong dot ek at gmail dot com | Date: | Mon, 18 Feb 2008 08:56:34 +0000 |
| Subject: | #44145 [NEW]: preg_replace using the e modifier problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-122373@lists.php.net to get a copy of this message | ||
From: phong dot ek at gmail dot com
Operating system: gentoo
PHP version: 5.2.5
PHP Bug Type: Regexps related
Bug description: preg_replace using the e modifier problem
Description:
------------
see reproduce code.
Reproduce code:
---------------
$message = '<a href="http://www.xxx.com"
target="_blank" class="des_link"
style="text-decoration:none">xxx</a>';
echo $message = preg_replace("/href=\"(.+)?\"/e",
"'href=\""."out.php?date='.htmlspecialchars(date('Y-m-d
H:i:s')).'&d='.urlencode('$1').'\"'", $message);
Expected result:
----------------
<a href="out.php?date=2008-02-18 15:43:03&d=http%3A%2F%2Fwww.xxx.com"
target="_blank" class="des_link"
style="text-decoration:none">xxx</a>
Actual result:
--------------
<a href="out.php?date=2008-02-18
15:43:03&d=http%3A%2F%2Fwww.xxx.com%5C%22+target%3D%5C%22_blank%5C%22+class%3D%5C%22des_link%5C%22+style%3D%5C%22text-decoration%3Anone">xxx</a>
--
Edit bug report at http://bugs.php.net/?id=44145&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44145&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44145&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44145&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44145&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44145&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44145&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44145&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44145&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44145&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44145&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44145&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44145&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44145&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44145&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44145&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44145&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44145&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44145&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44145&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44145&r=mysqlcfg