Your problem may be caused by HTML::Scrubber. See Mike's post http://webwork.maa.org/moodle/mod/forum/discuss.php?d=3132
You probably should apply the hotfixes to webwork2 and pg (see e.g. http://webwork.maa.org/wiki/Installation_Manual_for_2.7_on_Ubuntu_12.04#Updating_the_webwork2_code).
Arnie