Contribution Date
Technology
Contribution Project
Contribution Details
tested this in codepad http://codepad.org/EQlk2KA4
The following code should have returned all true. doesnt seem to be the case
function valid_email_address($mail) {
$name = '((?:"[^\"\f\n\r\t\v]+" <))?';
$angle = '>?';
$ret = preg_match("/^$name(.*?)$angle$/", $mail, $matches);
if (!$ret) {
return FALSE;
}
else {
return (bool) filter_var($matches[2], FILTER_VALIDATE_EMAIL);
}
}
echo "all values should be true";
var_dump(TRUE === valid_email_address('John Doe '));
var_dump(TRUE === valid_email_address('John Doe < johndoe@randommail.com >'));
var_dump(TRUE === valid_email_address('"John Doe" '));
var_dump(TRUE === valid_email_address('"John Doe" < johndoe@randommail.com >'));
all values should be true
Warning: preg_match(): Internal pcre_fullinfo() error -3 on line 6
bool(false)Warning: preg_match(): Internal pcre_fullinfo() error -3 on line 6
bool(false)Warning: preg_match(): Internal pcre_fullinfo() error -3 on line 6
bool(false)Warning: preg_match(): Internal pcre_fullinfo() error -3 on line 6
bool(false)
Issue Status
Needs work
Contribution Issue Link
Contribution Link
Files count
0
Patches count
0