Kreativsoehne / magento-2-simple-antispam

A Magento 2 extension for blocking (russian) spam bots creating new customer accounts
MIT License
7 stars 5 forks source link

fixed detection of spam field value for string position 0 cases #3

Open AdwiseRobVisser opened 4 years ago

AdwiseRobVisser commented 4 years ago

For detecting of spam-strings in posted values, this previous check did not work when a spam-value was at position 0 of the posted field (for example if the posted firstname field equals http://):

if (strpos($data[$field], $entry)) {

I changed the check to the following, which properly detects a spam-word if the posted value starts with that spam-word (spam-word is at position 0 of the posted value):

if (strpos($data[$field], $entry) !== false) {

php strpos documentation: Returns FALSE if the needle was not found.