|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66681 filter_var($email,FILTER_VALIDATE_EMAIL) error
Submitted: 2014-02-10 05:16 UTC Modified: 2014-12-30 10:42 UTC
From: dan at bigbirdmedia dot com Assigned:
Status: No Feedback Package: Filter related
PHP Version: Irrelevant OS: Apache/Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-02-10 05:16 UTC] dan at bigbirdmedia dot com
From manual page:

It seems that the filter_var() function doesn't quite work for all emails, at least not consistently.

Test script:

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 = '';

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>'.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-10 05:24 UTC]
-Status: Open +Status: Feedback
 [2014-02-10 05:24 UTC]
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?
 [2014-12-30 10:42 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 10:01:27 2024 UTC