php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dan at bigbirdmedia dot com
New email:
PHP Version: OS:

 

 [2014-02-10 05:16 UTC] 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>'.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-10 05:24 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2014-02-10 05:24 UTC] requinix@php.net
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: Thu Apr 25 01:01:30 2024 UTC