ne pas utiliser la validation php pour le moment
This commit is contained in:
parent
9bff7903a3
commit
da011b56cb
|
@ -8,9 +8,9 @@ class MailType extends RegexpType {
|
|||
protected function extractParsedValue(array $ms) {
|
||||
$mail = $ms[0];
|
||||
$mail = filter_var($mail, FILTER_SANITIZE_EMAIL);
|
||||
$mail = filter_var($mail, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE);
|
||||
//$mail = filter_var($mail, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE);
|
||||
if ($mail === false) return false;
|
||||
if (preg_match('/^([A-Za-z0-9.-]+)(\+[^@]*)?(@[A-Za-z0-9.-]+)$/', $mail, $ms)) {
|
||||
if (preg_match('/^([^@+]+)(\+[^@]*)?(@.+)$/', $mail, $ms)) {
|
||||
return [$ms[1], $ms[2], $ms[3]];
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -11,6 +11,7 @@ class MailTypeTest extends TestCase {
|
|||
self::assertSame("ADMIN@univ-reunion.fr", $type->with(" ADMIN@univ-reunion.fr "));
|
||||
self::assertSame("jephte.clain+MAILBOX@univ-reunion.fr", $type->with("JEPHTE.CLAIN+MAILBOX@UNIV-REUNION.FR"));
|
||||
self::assertSame("JEPHTECLAIN+MAILBOX@univ-reunion.fr", $type->with("JEPHTECLAIN+MAILBOX@UNIV-REUNION.FR"));
|
||||
self::assertSame("JEPHTE.CLAIN!+MAILBOX@UNIV-REUNION.FR", $type->with("JEPHTE.CLAIN!+MAILBOX@UNIV-REUNION.FR"));
|
||||
self::assertSame("jephte.clain!+MAILBOX@univ-reunion.fr", $type->with("JEPHTE.CLAIN!+MAILBOX@UNIV-REUNION.FR"));
|
||||
self::assertSame("prenom_nom@yahoo.fr", $type->with("prenom_nom@yahoo.fr"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue