MyBB Community Forums

Full Version: Bad word filter not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The word filter on my forum has stopped working. It's been working for years but stopped some time during the last couple of weeks.

As an example, the word Foxtrot Uniform Charlie Kilo, should be replaced by ****. I was being replaced but now it's not.

The config page is dead simple so I'm pretty certain I can't have messed that up. I've also checked the text that the users are entering. It should match a replacement in the word filter.

I'm currently running 1.8.18

Any suggestions?
When upgrading to 1.8.18 you should of read the release notes. See here.
Thank you Wires. Which bit of that are you directing me to re-read?

OK. Now on the latest version of MyBB.

Looks like a problem with the following line (659) in class_parser.php.

$message = preg_replace('#'.$badword['badword'].'#is', $badword['replacement'], $message);

Error message says the # is an "unknown modifier".

Why would I be getting that error message with the latest version of MyBB. I'm running PHP 7.1
(2018-10-08, 11:24 AM)broadsword Wrote: [ -> ]Thank you Wires.  Which bit of that are you directing me to re-read?

OK.  Now on the latest version of MyBB.

Looks like a problem with the following line (659) in class_parser.php.

  $message = preg_replace('#'.$badword['badword'].'#is', $badword['replacement'], $message);

Error message says the # is an "unknown modifier".

Why would I be getting that error message with the latest version of MyBB.  I'm running PHP 7.1

@Wires wants you to look at this section: READ THIS

Important notes: '*' and '+' are now used differently than previous versions. 
Read the section I told you about for clarity.
Thank you. I've read that carefully, twice now but I'm still struggling to see the relevance. My apologies.

Unless I comment out line (659) in class_parser.php my whole site immediately breaks with the error message thats tells me that # is an "unknown modifier".

I'm not using regex in the defintion of my word substitutions. So the f-word should simply be replaced by xxxx. Nothing clever in that.

The root cause must be something to do with my environment not liking liking line (659) in class_parser.php.

$message = preg_replace('#'.$badword['badword'].'#is', $badword['replacement'], $message);

What am I missing?