MyBB Community Forums

Full Version: Bad words filter is not working in 1.8.17
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Bad words filter is not working in 1.8.17 for *jeb* and *јеб* on https://www.medicinari.com/forum at all.

When that is checked as Regular Expression I am getting on front end of forum next:

Quote:Warning [2] preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 - Line: 655 - File: inc/class_parser.php PHP 5.3.29 (Linux)
File
Line
Function[PHP]
 
errorHandler->error
/inc/class_parser.php
655
preg_replace
/inc/functions_post.php
169
postParser->parse_badwords
/showthread.php
1110
build_postbit
Warning [2] preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 - Line: 655 - File: inc/class_parser.php PHP 5.3.29 (Linux)
File
Line
Function[PHP]
 
errorHandler->error
/inc/class_parser.php
655
preg_replace
/inc/class_parser.php
134
postParser->parse_badwords
/inc/functions_post.php
774
postParser->parse_message
/showthread.php
1110
build_postbit
Warning [2] preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 - Line: 655 - File: inc/class_parser.php PHP 5.3.29 (Linux)
File
Line
Function[PHP]
 
errorHandler->error
/inc/class_parser.php
655
preg_replace
/inc/class_parser.php
134
postParser->parse_badwords
/inc/functions_post.php
774
postParser->parse_message
/showthread.php
1110
build_postbit
Line
Function[PHP]
 
errorHandler->error
/inc/class_parser.php
655
preg_replace
/inc/functions_post.php
169
postParser->parse_badwords
/showthread.php
1110
build_postbit


Regards,
Serbian Translator
It's because your string contains a star (*) which isn't a regular expression, hence the error. This isn't intended behaviour though as it messes with the thread subject and message, as well as PHP errors shouldn't be displayed to the end-user.

We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/3354

Thanks for contributing to MyBB!
(2018-07-22, 09:30 AM)Wires Wrote: [ -> ]It's because your string contains a star (*) which isn't a regular expression, hence the error.

Ok, it is clear, but Bad words filter is not working in 1.8.17 for *jeb* and *јеб* on https://www.medicinari.com/forum at all, even without marking Regular Expresion... Why?
(2018-07-22, 09:53 AM)vojislavradoja Wrote: [ -> ]
(2018-07-22, 09:30 AM)Wires Wrote: [ -> ]It's because your string contains a star (*) which isn't a regular expression, hence the error.

Ok, it is clear, but Bad words filter is not working in 1.8.17 for *jeb* and *јеб* on https://www.medicinari.com/forum at all, even without marking Regular Expresion... Why?

What's the exact word you're trying in that you want to be filtered?
(2018-07-22, 09:59 AM)Wires Wrote: [ -> ]
(2018-07-22, 09:53 AM)vojislavradoja Wrote: [ -> ]
(2018-07-22, 09:30 AM)Wires Wrote: [ -> ]It's because your string contains a star (*) which isn't a regular expression, hence the error.

Ok, it is clear, but Bad words filter is not working in 1.8.17 for *jeb* and *јеб* on https://www.medicinari.com/forum at all, even without marking Regular Expresion... Why?

What's the exact word you're trying in that you want to be filtered?

Any Serbian word containing jeb or јеб , for example: Zajebancija, Зајебанција.
This is also a known issue here. A fix has been applied but it's awaiting a review and needs testing: https://github.com/mybb/mybb/pull/3353
(2018-07-22, 09:30 AM)Wires Wrote: [ -> ]It's because your string contains a star (*) which isn't a regular expression, hence the error.

This is partially true. Having * in an expression makes it VALID.
However, as '*' in regex means to match the previous character 0 or more times, in your expression if you start with '*' there is no previous character to match, hence the error. A validation is indeed required.

Not particularly in this case but its an old known issue that the bad word filter is buggy:
https://github.com/mybb/mybb/issues/3262

And a new approach handling this is waiting to be merged, you can play and test with the new modifications while it is getting merged:
https://github.com/mybb/mybb/pull/3353/files

Edit: oops, ninja'd Toungue
Thank you both.
Also the validation patch for handling PHP warning is in place for review ...
https://github.com/mybb/mybb/pull/3355/files
Just asking: since they basically _look_ the same, did you make sure that in the cyrillic string the <je> are Serbian cyrillic letters not latin letters? They look alike, but have different Unicode points and will thus be treated as different in a database search etc.:
Cyrillic: u0435 u0458 : је
Latin: u006A u0065 : je

If you want to be 100% safe, you'd need to have four patterns to exclude, because people use these lookalike letters all the time to circumvent filters:
<jeb> (all Latin)
<јеb> (Cyrillic је plus Latin b)
<јеб> (all Cyrillic)
<jeб> (Latin je, Cyrillic b)
Pages: 1 2