#49699 [NEW]: str_rot13 in combination with preg_replace doesnt work
| From: | william at 1moment dot nl | Date: | Mon, 28 Sep 2009 15:37:04 +0000 |
| Subject: | #49699 [NEW]: str_rot13 in combination with preg_replace doesnt work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-143001@lists.php.net to get a copy of this message | ||
From: william at 1moment dot nl
Operating system: UNIX
PHP version: 5.3SVN-2009-09-28 (SVN)
PHP Bug Type: Unknown/Other Function
Bug description: str_rot13 in combination with preg_replace doesnt work
Description:
------------
When using str_rot13 within a preg_replace context the string won't be
rotated, but stays the same.
Reproduce code:
---------------
function addRotation($string) {
//return md5($string); // This works
return str_rot13($string); // This won't work
}
$output = '<html><head><head><body><a
href="mailto:example@example.com">this
is a test</a></body></html>';
$parsed =
preg_replace("/\"mailto:([A-Za-z0-9._%-]+)\@([A-Za-z0-9._%-]+)\.([A-Za-z.]{2,4})\"/",
"\"folder/?e=" . addRotation('\\1') . "+" .
addRotation('\\2') . "+" .
addRotation('\\3') ."\" rel=\"nofollow\"
target=\"_blank\"", $output);
echo $parsed;
Expected result:
----------------
<html><head><head><body><a
href="/folder/?e=rknzcyr@rknzcyr.com">this is a
test</a></body></html>
Actual result:
--------------
<html><head><head><body><a
href="/folder/?e=example@example.com">this is a
test</a></body></html>
--
Edit bug report at http://bugs.php.net/?id=49699&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49699&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49699&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49699&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49699&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49699&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49699&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49699&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49699&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49699&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49699&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49699&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49699&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49699&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49699&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49699&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49699&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49699&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49699&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49699&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49699&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49699&r=mysqlcfg