php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61012 filter_var don't pass valid email address
Submitted: 2012-02-08 14:58 UTC Modified: 2012-02-09 08:43 UTC
From: sucotronic at gmail dot com Assigned:
Status: Not a bug Package: Mail related
PHP Version: 5.3SVN-2012-02-08 (snap) OS: linux ubuntu 10.04
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: sucotronic at gmail dot com
New email:
PHP Version: OS:

 

 [2012-02-08 14:58 UTC] sucotronic at gmail dot com
Description:
------------
If you use the filter_var function to test an email address, and the address 
starts with the '+' sign, it's marked as invalid, but it isn't.

Test script:
---------------
filter_var("+4654651651@test.com", FILTER_VALIDATE_EMAIL)

Expected result:
----------------
Return the string and not false.

Actual result:
--------------
false

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-08 16:49 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2012-02-08 16:49 UTC] rasmus@php.net
Unable to reproduce in 5.3/5.4:

php > echo filter_var("+4654651651@test.com", FILTER_VALIDATE_EMAIL);
+4654651651@test.com

Make sure you are actually trying this in 5.3. This may have been broken in 5.2, 
but was fixed years ago in 5.3.
 [2012-02-08 17:55 UTC] sucotronic at gmail dot com
More exactly, my version is: 5.3.2-1ubuntu4.11
 [2012-02-08 18:12 UTC] anon at anon dot anon
I also get false, using PHP 5.3.2/Windows.

But according to the change log, FILTER_VALIDATE_EMAIL was overhauled in PHP 5.3.3, in July 2010, after this bug report: https://bugs.php.net/bug.php?id=49576
 [2012-02-08 18:58 UTC] rasmus@php.net
Yes, this was fixed in July 2010 in 5.3.3.
 [2012-02-09 08:43 UTC] sucotronic at gmail dot com
Ok, I found it at: https://bugs.php.net/bug.php?id=49576 fixed in 5.3.3 release 
and open a bug in ubuntu to request to update it 
(https://bugs.launchpad.net/ubuntu/+source/php5/+bug/929387). Thanks for help.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Oct 07 13:05:54 2022 UTC