It would be nice to have plus signs properly included in email addresses.

#90902: urlfilter does not catch several legal email address formats (local part with ', quoted local part, etc.) doesn't look fixed to me, but this patch does not fix it either.
#1657886: Filter "Convert URLs into links" doesn't support multilingual web addresses is over my head.

Expand the patch if you like. I don't know about other characters, but is there a reason not to include plus signs?

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because '+' signs are stripped from email addresses, using only the part after the plus sign
Issue priority Not critical
Prioritized changes The main goal of this issue is usability to allow + signs in email addresses (which are perfectly valid)

Comments

David_Rothstein’s picture

Version: 7.x-dev » 8.0.x-dev
Status: Needs review » Needs work
Issue tags: +Needs backport to D7

Looks like a good fix to me - plus signs are valid in email addresses and without this patch it only picks up the parts after the plus sign as being a linkable email address, which is just broken.

Needs to go into Drupal 8 first though.

jacob.embree’s picture

The relevant line in Drupal 8 right now is filter.module:570:

$url_pattern = "[\p{L}\p{M}\p{N}._-]{1,254}@(?:$domain)";

I can confirm that this is an issue for Drupal 8. I don't understand that line yet.

jacob.embree’s picture

Status: Needs work » Needs review
StatusFileSize
new552 bytes

That was easy.
The pattern can be understood after reading Unicode character properties at PHP.net.

jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Let's add a test for this in FilterUnitTest.

justachris’s picture

Issue tags: +Novice

Adding novice tag, adding a test for this should be very approachable for someone new to contributing, as should the review of the patch.

dcmul’s picture

Status: Needs work » Needs review
StatusFileSize
new1.94 KB
new2.06 KB

Hope this works.

ByronNorris’s picture

StatusFileSize
new176.19 KB
new170.39 KB
new81.14 KB

Looks good. Here are screenshots post-patch:

At Install
email with plus character - install

User edit
email with plus character - user edit

FilterUnitTest
email with plus character - FilterUnitTest

jhedstrom’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

This looks good to me as well. I added a beta evaluation.

jhedstrom’s picture

Issue summary: View changes
alexpott’s picture

Version: 8.0.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed d47bd72 and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to the issue summary.

  • alexpott committed d47bd72 on
    Issue #2392109 by jacob.embree, dcmul, ByronNorris, jhedstrom: Filter:...
ByronNorris’s picture

StatusFileSize
new522 bytes

I've added a small patch for D7, but need a sanity check. I tried D7.38 at simplytest.me and 7.x branch locally. Both allowed me to create accounts with emails containing plus signs without the patch. Does this match up with what others see when they try to add a user with an email containing a plus sign?

cilefen’s picture

Issue tags: +Needs tests

One way to be sure is to add tests.

David_Rothstein’s picture

Status: Patch (to be ported) » Needs work

The patch looks good, but yes, the Drupal 8 tests need to be backported also.

As far as I understand, this was only ever a bug with the text filtering, not with other places in core that use email addresses. (If it were other places too, like account creation, it would definitely be a more serious bug!)

sumitmadan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.83 KB

Backported test also.

Status: Needs review » Needs work

The last submitted patch, 15: filter_allow_plus_sign-2392109-15.patch, failed testing.

sumitmadan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.84 KB

ckaotik’s picture

Issue tags: +Barcelona2015

Working on the review at the mentored sprint in Barcelona with Gregg Marshall.

ckaotik’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new38.42 KB
new37.96 KB

Reviewed the backport to D7 on 7.39, works like a charm.

Before:
D7.39 before applying patch

After:
D7.39 after applying patch

Barcelona Sprints: We're now done with this issue :)

greggmarshall’s picture

double checked while mentoring

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +7.40 release notes

Committed to 7.x - thanks!

  • David_Rothstein committed 792aca6 on 7.x
    Issue #2392109 by jacob.embree, sumitmadan, ByronNorris, dcmul, ckaotik...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.