php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55008 PHP Filter email doesn't work for facebook emails
Submitted: 2011-06-07 16:25 UTC Modified: 2011-06-07 17:52 UTC
From: zedorg at gmail dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.3.6 OS: x86_64 GNU/Linux
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: zedorg at gmail dot com
New email:
PHP Version: OS:

 

 [2011-06-07 16:25 UTC] zedorg at gmail dot com
Description:
------------
Hello,

it seems the filter function is not working the "new" facebook emails like: apps+xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@proxymail.facebook.com where x is an alpha numeric character. It returns false.

This new feature comes from 2010 January, see: http://www.allfacebook.com/facebook-developers-prepare-to-gain-access-to-user-emails-2010-01

We got a lot of validation failures, cause of this, from facebook connected users, when we trying to use filter_var on these emails.

A bit strange, cause if I change the "apps+xxxxxxxxxxxxxxx" to "apps+xxxxxxxxxx", 5 letter shorted, it accepts. However this won't help us :)

Test script:
---------------
<?php

var_dump(filter_var("apps+xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@proxymail.facebook.com", FILTER_VALIDATE_EMAIL));


Expected result:
----------------
It should return the given email address.

Actual result:
--------------
Returns false.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-07 16:29 UTC] zedorg at gmail dot com
Checked rfc, if this is the good one http://tools.ietf.org/html/rfc5321 , and it says "The maximum total length of a user name or other local-part is 64 octets."
However facebook uses 70?
 [2011-06-07 17:52 UTC] dtajchreber@php.net
-Status: Open +Status: Bogus
 [2011-06-07 17:52 UTC] dtajchreber@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The filter extension uses a regular expression based on RFC 5321, which like you 
found, says that the limit on a local-part of an e-mail is 64 octets. 

[1] http://lxr.php.net/xref/PHP_5_3/ext/filter/logical_filters.c#499
[2] http://tools.ietf.org/html/rfc5321#section-4.5.3.1
 [2011-06-08 17:09 UTC] zedorg at gmail dot com
Just for who has the similar problem: facebook accepts these emails without the "apps+" prefix, so this can be cut from email and then its rfc compliant again.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC