Bug #66681 [Opn->Fbk]: filter_var($email,FILTER_VALIDATE_EMAIL) error
| From: | requinix@php.net | Date: | Mon, 10 Feb 2014 05:24:14 +0000 |
| Subject: | Bug #66681 [Opn->Fbk]: filter_var($email,FILTER_VALIDATE_EMAIL) error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-184232@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66681&edit=1
ID: 66681
Updated by: requinix@php.net
Reported by: dan at bigbirdmedia dot com
Summary: filter_var($email,FILTER_VALIDATE_EMAIL) error
-Status: Open
+Status: Feedback
Type: Bug
Package: Filter related
Operating System: Apache/Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Works for me.
Your function returns false if the filter_var check fails or the checkdnsrr check fails. You need to
figure out which is happening.
And the PHP version is not irrelevant. What are you using?
Previous Comments:
------------------------------------------------------------------------
[2014-02-10 05:16:22] dan at bigbirdmedia dot com
Description:
------------
---
From manual page: http://www.php.net/filter.examples.validation
---
It seems that the filter_var() function doesn't quite work for all emails, at least not
consistently.
Test script:
---------------
<?php
function domainExists($email) {
if(filter_var($email,FILTER_VALIDATE_EMAIL)) {
list($user, $domain) = explode('@', $email);
if(checkdnsrr($domain, 'MX')) {
return TRUE;
}
else {
return FALSE;
}
}
else {
return FALSE;
}
}
$rm = 'jane_doe@hotmail.com';
if(domainExists($rm) === TRUE) {
echo '<p>It worked!</p>';
}
else {
echo '<p>It didn\'t work!</p>';
}
?>
Expected result:
----------------
I expect the function in the test/sample script to return true and echo '<p>It
worked!</p>'.
Actual result:
--------------
The actual result is '<p>It didn\'t work!</p>'.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66681&edit=1