It looks like one of you variables isent set probably $swear or $x has taken the array past its limit. What you should do is echo each part of the line to see whats in it.
<?php
echo "(".$swear[$x].")<BR>";
echo "(".$message.")<BR>";
$message = str_replace($swear[$x], str_repeat("*", strlen($swear[$x])), stripslashes($message));
?>
That will tell you if what your working with has any content. My guess is that somewhere the $swear goes null and the str_replace doesnt like it.
Mark.