php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56689 Add an RFC822 filter for e-mail in addition to the existing e-mail filter
Submitted: 2005-12-02 22:10 UTC Modified: 2005-12-12 02:50 UTC
From: ramsey@php.net Assigned:
Status: Wont fix Package: filter (PECL)
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-12-02 22:10 UTC] ramsey@php.net
Description:
------------
Use mail.h and rfc822.h from the c-client library to create a filter ("FL_RFC822") to allow e-mail addresses to be filtered as RFC822-compliant addresses. This filter would be in addition to the existing FL_EMAIL filter.

I have a patch for this, but I don't want to post it here since it's 105 lines. So, I'll send it to derick and sniper via e-mail.

The caveat involved in my patch is this: currently, mail.h and rfc822.h must exist in the c-client folder in the system path. This is not exactly efficient or preferrable. It would be best if pecl/filter determines the location of these headers either by the configuration value if PHP was compiled --with-imap or a new config option being added to the configure line for pecl/filter. In either case, the FL_RFC822 filter should probably be disabled if the headers aren't available so that it can be compiled and used anyway without the RFC822 functionality.

Reproduce code:
---------------
Example of how it works:

<?php
$email1 = 'John Doe <jdoe@example.org> (comment)';
$email2 = 'Jane Doe <jane@> (comment)';

var_dump(filter_data($email1, FL_RFC822));
var_dump(filter_data($email2, FL_RFC822));
?>

Expected result:
----------------
string(37) "John Doe <jdoe@example.org> (comment)"
NULL


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-12 02:50 UTC] derick@php.net
I don't want the filter extension to rely on external libraries in any way as this makes writing portable applications that use input filtering a bit impossible.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun May 19 12:01:26 2019 UTC