Bug #30311
closedProblems with the validation of a email-address which contains umlauts - t3lib_div.validEmail
Added by David M. about 13 years ago. Updated about 6 years ago.
100%
Description
It seems like the t3lib_div.validEmail function returns false negatives, when you use email-addresses with umlauts like admin@schön.at because the FILTER_VALIDATE_EMAIL is too strict. At http://php.net/manual/de/function.filter-var.php#104160 you can see a possible workaround for this, although it would be nicer with a punycode implementation.
Files
class.t3lib_divTest.php (100 KB) class.t3lib_divTest.php | Updated Testcases | David M., 2011-09-29 14:40 | |
idna_convert.class.php (92.6 KB) idna_convert.class.php | Converter Class (IDN) - Credits to Matthias Sommerfeld | David M., 2011-09-29 14:40 |
Updated by Markus Klein about 13 years ago
Hi! Can you provide a patch for this?
Updated by Christian Kuhn about 13 years ago
The method is covered by unit tests. A proper patch should include test cases as well.
Updated by David M. about 13 years ago
- File class.t3lib_divTest.php class.t3lib_divTest.php added
- File idna_convert.class.php idna_convert.class.php added
I noticed the same problem with umlauts in URLs.
My suggestion for the patch would be:
somewhere else:
$IDN = new idna_convert(array('idn_version' => 2008));
for class.t3lib_div:
/** * Checking syntax of input email address * * @param string $email Input string to evaluate * @return boolean Returns TRUE if the $email address (input string) is valid */ public static function validEmail($email) { // enforce maximum length to prevent libpcre recursion crash bug #52929 in PHP // fixed in PHP 5.3.4; length restriction per SMTP RFC 2821 if (strlen($email) > 320) { return FALSE; } return (filter_var($IDN->encode($email), FILTER_VALIDATE_EMAIL) !== FALSE); } /** * Checks if a given string is a Uniform Resource Locator (URL). * * @param string $url The URL to be validated * @return boolean Whether the given URL is valid */ public static function isValidUrl($url) { return (filter_var($IDN->encode($url), FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) !== FALSE); }
Updated by Peter Niederlag about 13 years ago
- Status changed from New to Accepted
- Target version set to 4.6.0
- Estimated time set to 2.00 h
- Complexity set to easy
Hi David. Your proposal seems fine to me, could you maybe make this into a patch/review-request?
idna_convert.class.php is already available in typo3/contrib/idna for #14500.
Updated by Chris topher about 13 years ago
- Target version changed from 4.6.0 to 4.6.1
Updated by Mr. Jenkins almost 13 years ago
- Status changed from Accepted to Under Review
Patch set 1 of change Iaff6d43c54ce4a2567b46acfe449e33b89136f8d has been pushed to the review server.
It is available at http://review.typo3.org/6907
Updated by Chris topher almost 13 years ago
- Target version changed from 4.6.1 to 4.6.2
Updated by Gerrit Code Review almost 13 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6907
Updated by Oliver Klee almost 13 years ago
Are you sure that the local part really may contain non-ASCII characters? AFAIK, punycode only applies to the domain part.
Updated by Xavier Perseguers almost 13 years ago
- Target version deleted (
4.6.2)
Updated by Gerrit Code Review over 12 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6907
Updated by Gerrit Code Review over 12 years ago
Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/9434
Updated by Gerrit Code Review over 12 years ago
Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/9435
Updated by Gerrit Code Review over 12 years ago
Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/9436
Updated by Mario Rimann over 12 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6a1632ec35deecfcd7179ce4ad52efcff667d3f2.
Updated by Gerrit Code Review over 12 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/9435
Updated by Gerrit Code Review over 12 years ago
Patch set 3 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/9435
Updated by Mario Rimann about 12 years ago
- Status changed from Under Review to Resolved
Applied in changeset c4239fa00a326f20c49d74cfb32cda495fcc8b41.