Upgrade to 3.2.3

This commit is contained in:
Bastian Allgeier
2019-08-06 10:24:12 +02:00
parent 40f095f5de
commit 02be32bb75
48 changed files with 356 additions and 114 deletions

View File

@@ -3,6 +3,7 @@
namespace Kirby\Toolkit;
use Exception;
use Kirby\Http\Idn;
use Kirby\Toolkit\Str;
use ReflectionFunction;
use Throwable;
@@ -270,7 +271,20 @@ V::$validators = [
* Checks for valid email addresses
*/
'email' => function ($value): bool {
return filter_var($value, FILTER_VALIDATE_EMAIL) !== false;
if (filter_var($value, FILTER_VALIDATE_EMAIL) === false) {
try {
$parts = Str::split($value, '@');
$address = $parts[0] ?? null;
$domain = Idn::encode($parts[1] ?? '');
$email = $address . '@' . $domain;
} catch (Throwable $e) {
return false;
}
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}
return true;
},
/**