php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47772 filter_var() returnes nothing for some invalid e-mails
Submitted: 2009-03-25 13:31 UTC Modified: 2009-03-25 18:52 UTC
From: saschagros at gmail dot com Assigned:
Status: Closed Package: Filter related
PHP Version: 5.3.0RC1 OS: Ubuntu 9.04 Jaunty
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: saschagros at gmail dot com
New email:
PHP Version: OS:

 

 [2009-03-25 13:31 UTC] saschagros at gmail dot com
Description:
------------
filter_var incorrectly validates some invalid e-mail adresses (see reproduce code).

Note: I am not 100% sure that this is the wrong behavior, however, it has changed from php 5.2 and I can't find a related bug or NEWS entry.

Reproduce code:
---------------
var_dump(filter_var('invalid@site', FILTER_VALIDATE_EMAIL));
var_dump(filter_var('invalid@site.', FILTER_VALIDATE_EMAIL));

Expected result:
----------------
bool(false)
bool(false)

Actual result:
--------------
string(13) "invalid@site."
string(12) "invalid@site"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-25 18:52 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Your 1st e-mail is valid, in fact many "local" domains on intranets 
would not have a domain extension. foo@bar is perfectly valid.

The allowance for foo@bar. is a bug and a fix for it has just been 
applied.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC