|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-11-12 14:56 UTC] andrew dot nicols at luns dot net dot uk
Description:
------------
The filter_var function, when used with FILTER_VALIDATE_EMAIL marks an email address with an = in it as invalid.
According to RFCs 822, 2822 and 5322, = is a valid component to the local-part of an e-mail address.
Reproduce code:
---------------
<?php
$email_address = "test=mail@example.com";
var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
$email_address = "test-mail@example.com";
var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
$email_address = "test+mail@example.com";
var_dump(filter_var($email_address, FILTER_VALIDATE_EMAIL));
?>
Expected result:
----------------
string(21) "test-mail@example.com"
string(21) "test-mail@example.com"
string(21) "test+mail@example.com"
Actual result:
--------------
bool(false)
string(21) "test+mail@example.com"
string(21) "test+mail@example.com"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 21 21:00:01 2025 UTC |
Yes, = is valid. And also any of these too: ! $ & * - = ^ ` | ~ # % ' + / ? _ { }