Actions
Bug #95963
closedEmailValidation does not allow for leading or trailing spaces in email address
Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2021-11-12
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
Email validation is - for my understanding - to strict.
When entering an email address into a form field having type "email", the entered data gets validated.
If that email was entered with leading/trailing spaces, validation fails.
Without the validator, email adresses with leading/trailing spaces do not cause any issues when submitting the form. Only the validator chokes.
The validator class itsself does not cause the issue, but the GeneralUtility does.
The following function in TYPO3\CMS\Core\Utility\GeneralUtility compares the email value to its trimmed version and returns false if there is a difference.
/** * Checking syntax of input email address * * @param string $email Input string to evaluate * @return bool Returns TRUE if the $email address (input string) is valid */ public static function validEmail($email) { // Early return in case input is not a string if (!is_string($email)) { return false; } if (trim($email) !== $email) { return false; } $validator = new EmailValidator(); return $validator->isValid($email, new RFCValidation()); }
Can this comparison be removed?
Thanks!
Actions