From: floyd dot mcmichael at alaska dot gov
Operating system: windows
PHP version: 5.2.5
PHP Bug Type: *Regular Expressions
Bug description: preg_replace() returns blank string
Description:
------------
preg_replace blanks a string that it didn't use to in previous versions of
PHP 5.x. other preg_replace strings not affected
Reproduce code:
---------------
function doSmiles($string, $skinname)
{
$patterns = array(
"/\[alien\]/i",
... snipped due to length ...
"/\[crazy\]/i"
);
$replacements = array(
"<img src=\"./skin/$skinname/emotes/alien.png\" alt=\"alien\"
title=\"alien\">",
... snip due to length ...
"<img src=\"./skin/$skinname/emotes/crazy.png\"
src=\"./skin/$skinname/emotes/crazy.png\" alt=\"crazy\" title=\"crazy\">"
);
$string = preg_replace($patterns, $replacements, $string);
return $string;
}
Expected result:
----------------
print substrings like [alien] to html-valid strings like <img
src="./skin/default/alien.png">. prior to upgrading to 5.2.5 this
particular function DID work. it no longer works.
Actual result:
--------------
returns a blank string ""
--
Edit bug report at http://bugs.php.net/?id=43872&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43872&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43872&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43872&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43872&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43872&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43872&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43872&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43872&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43872&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43872&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43872&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43872&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43872&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43872&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43872&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43872&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43872&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43872&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43872&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43872&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43872&r=mysqlcfg