Fixed Automatic email tagging misses full email address in some cases


Well-known member
Affected version
2.2.6 Patch 2
As the title says, the full email address is left out of the automatic email tagging in some cases if part of the domain has numbers. An example of such a case is here:

Notice that in the second post the email address is fully included, because it uses all letters, but the address using numbers is not.
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.7).

Change log:
When autolinking emails expand the range of word characters permitted in additional domain parts.
There may be a delay before changes are rolled out to the XenForo Community.
Thank you!

Would it be possible for someone to let me know how I can fix this on my site now, so I don't have to wait for the next release? A lot of folks on my site have this type of email address so I'm having to fix posts almost daily as it is so that people aren't accidentally emailing the wrong address.
This is the diff created when the code was fixed (find the red line, replace it with the green line):

diff --git a/src/XF/BbCode/ProcessorAction/AutoLink.php b/src/XF/BbCode/ProcessorAction/AutoLink.php
index 66003a3945..5ab78707a4 100644
--- a/src/XF/BbCode/ProcessorAction/AutoLink.php
+++ b/src/XF/BbCode/ProcessorAction/AutoLink.php
@@ -186,7 +186,7 @@ function ($match) use ($processor, &$placeholders)
             // assertion to prevent matching email in url matched above (
             $string = preg_replace_callback(
-                '#[a-z0-9.+_-]+@[a-z0-9-]+(\.[a-z]+)+(?![^\s"]*\[/url\])#iu',
+                '#[a-z0-9.+_-]+@[a-z0-9-]+(\.[a-z0-9-]+)+(?![^\s"]*\[/url\])#iu',
                 function ($match) use ($processor)
                     $this->incrementTagUsageCount($processor, 'email');
Top Bottom