ConsoleTVs / Profanity

PHP library to block bad words in a string
MIT License
98 stars 46 forks source link

Wrong detection #19

Open olezhkafp opened 3 years ago

olezhkafp commented 3 years ago

Hi. for example we have string like this:

$value = '<p><span style="color: rgb(246,139,106);">Lauren J.</span>, Hi</p>';

In this case 139 will be replaced as *** because:

Profanity::blocker(trim($value))->badWords() detects the bad word:

Array
(
    [2261] => Array
        (
            [language] => zh
            [word] => 13.
        )
)

Is it possible to fix? as '139' != '13.'

Darthmaul commented 3 years ago

Hey @olezhkafp did you ever figure out a fix for this? We are facing this issue as well

ConsoleTVs commented 3 years ago

Hello sorry for the issue. Could we perhaps remove this word from the blocked list? I have no idea about that language but looks odd

olezhkafp commented 3 years ago

Hey @olezhkafp did you ever figure out a fix for this? We are facing this issue as well

@Darthmaul Yes, we care copied the json file with the bad words, modified it and use instead of basic one.

olezhkafp commented 3 years ago

Hello sorry for the issue. Could we perhaps remove this word from the blocked list? I have no idea about that language but looks odd

@ConsoleTVs yes, looks like this is some issue and not the bad word. I think "13." can not be some bad word)

ConsoleTVs commented 3 years ago

Hey guys, care to test version 3.0.3 with a potential fix?

sebastianheise commented 2 years ago

I know this is solved, but I'd just like to add a guess here: With the dot in regex it could have been an issue with incorrect (or no) escaping, making it a one character wildcard 13. => 130, 131, 132, 13A, etc.