Skip to content
Snippets Groups Projects
Commit 183e49f5 authored by Florian Mast's avatar Florian Mast Committed by Jan Helke
Browse files

[BUGFIX] EXT:form Validation of email

Validation of email should respect empty value

Resolves: #54534
Releases: master,7.6
Change-Id: I40c865b42fe7960dd7ab85f710df1045cd04adf0
Reviewed-on: https://review.typo3.org/47059


Reviewed-by: default avatarNicole Cordes <typo3@cordes.co>
Tested-by: default avatarNicole Cordes <typo3@cordes.co>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarJan Helke <typo3@helke.de>
Tested-by: default avatarJan Helke <typo3@helke.de>
parent 02258e47
Branches
Tags
No related merge requests found
......@@ -14,6 +14,11 @@ namespace TYPO3\CMS\Form\Domain\Validator;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class EmailValidator
*/
class EmailValidator extends AbstractValidator
{
/**
......@@ -32,7 +37,11 @@ class EmailValidator extends AbstractValidator
*/
public function isValid($value)
{
if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($value)) {
if (empty($value) || !is_string($value)) {
return;
}
if (!GeneralUtility::validEmail($value)) {
$this->addError(
$this->renderMessage(
$this->options['errorMessage'][0],
......
......@@ -31,7 +31,9 @@ class EmailValidatorTest extends AbstractValidatorTest
{
return array(
'a@b.de' => array('a@b.de'),
'somebody@mymac.local' => array('somebody@mymac.local')
'somebody@mymac.local' => array('somebody@mymac.local'),
'empty value' => array(''),
'unexpected value' => array(array()),
);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment