Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #39 #43

Merged
merged 1 commit into from
Aug 3, 2017
Merged

Fixes #39 #43

merged 1 commit into from
Aug 3, 2017

Conversation

neilcrookes
Copy link
Contributor

The problem is caused when calling setDictionary() with an array of languages, and the array_unique() call on https://github.com/snipe/banbuilder/blob/master/src/CensorWords.php#L64 within that method removes items from the badwords array. The problem itself is that the remaining keys are not sequential, but the loop inside the generateCensorChecks() method on https://github.com/snipe/banbuilder/blob/master/src/CensorWords.php#L146 does expect them to be sequential. The result is a undefined index error. This change fixes that issue, and also improves performance by removing duplicate badwords if there are any, after calling readBadwords(), e.g. via multiple calls to addDictionary(), with a string argument, instead of an array.

The problem is caused when calling setDictionary() with an array of languages, and the array_unique() call on https://github.com/snipe/banbuilder/blob/master/src/CensorWords.php#L64 within that method removes items from the badwords array. The problem itself is that the remaining keys are not sequential, but the loop inside the generateCensorChecks() method on https://github.com/snipe/banbuilder/blob/master/src/CensorWords.php#L146 does expect them to be sequential. The result is a `undefined index` error. This change fixes that issue, and also improves performance by removing duplicate badwords if there are any, after calling readBadwords(), e.g. via multiple calls to addDictionary(), with a string argument, instead of an array.
@snipe snipe merged commit 0d46356 into snipe:master Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants