ID: 43872
User updated by: floyd dot mcmichael at alaska dot gov
Reported By: floyd dot mcmichael at alaska dot gov
Status: Open
Bug Type: *Regular Expressions
Operating System: windows
PHP Version: 5.2.5
New Comment:
EDIT:
"<img src=\"./skin/$skinname/emotes/crazy.png\"
src=\"./skin/$skinname/emotes/crazy.png\" alt=\"crazy\"
title=\"crazy\">"
should be "<img src=\"./skin/$skinname/emotes/crazy.png\"
alt=\"crazy\"
title=\"crazy\">"
preg_last_error(); returns 0 NO_ERROR.
why is this function not working as expected?
Previous Comments:
------------------------------------------------------------------------
[2008-01-16 23:45:51] floyd dot mcmichael at alaska dot gov
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 this bug report at http://bugs.php.net/?id=43872&edit=1