Bug #66681 [NEW]: filter_var($email,FILTER_VALIDATE_EMAIL) error

From: Date: Mon, 10 Feb 2014 05:16:24 +0000
Subject: Bug #66681 [NEW]: filter_var($email,FILTER_VALIDATE_EMAIL) error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184231@lists.php.net to get a copy of this message
From: dan at bigbirdmedia dot com Operating system: Apache/Linux PHP version: Irrelevant Package: Filter related Bug Type: Bug Bug description:filter_var($email,FILTER_VALIDATE_EMAIL) error 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 bug report at https://bugs.php.net/bug.php?id=66681&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66681&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66681&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66681&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66681&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66681&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66681&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66681&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66681&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66681&r=support Expected behavior: https://bugs.php.net/fix.php?id=66681&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66681&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66681&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66681&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66681&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66681&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66681&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66681&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66681&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66681&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66681&r=mysqlcfg

« previous php.bugs (#184231) next »