Skip to content

Commit

Permalink
Replace strlen with mb_strlen
Browse files Browse the repository at this point in the history
  • Loading branch information
Omranic committed Dec 29, 2022
1 parent aeba8be commit e9aeac6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Providers/CountryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public function boot()
{
// Add country validation rule
Validator::extend('country', function ($attribute, $value) {
return is_string($value) && strlen($value) === 2 && array_key_exists(mb_strtolower($value), countries());
return is_string($value) && mb_strlen($value) === 2 && array_key_exists(mb_strtolower($value), countries());
}, trans('validation.invalid_country'));

// Add currency validation rule
Validator::extend('currency', function ($attribute, $value) {
return is_string($value) && strlen($value) === 3 && array_key_exists(mb_strtoupper($value), currencies());
return is_string($value) && mb_strlen($value) === 3 && array_key_exists(mb_strtoupper($value), currencies());
}, trans('validation.invalid_currency'));
}
}

0 comments on commit e9aeac6

Please sign in to comment.