in MagicWord::matchAndRemove():
$text = preg_replace( $regex, '', $text );
if preg_replace errors, it will log a warning and then return null. At some point, $text will be cast to an empty string. We should throw an exception if it errors, instead of silently failing.
Related: https://wikitech.wikimedia.org/wiki/Incident_documentation/20151014-MediaWiki