Support » Plugin: Pixeline's Email Protector » Partly identical addresses may not be caught

  • Resolved pdaengeli


    I found that addresses are not properly obfuscated and resolved when a partly identical, but shorter address is found first.

    To give two examples, the addresses and result in two links to and the addresses and both are displayed as

    As such cases are rare it might be enough to sort (usort) the expressions by length in the main/secondary function.

Viewing 10 replies - 1 through 10 (of 10 total)
  • This is happening to me too. How did you fix it?

    I’m also having this issue… more with a and both showing up as, but it’s the same issue.

    Unfortunately, I’m not of much help, but, if I find a resolution, I’ll try to post it here. Did either of you figure any way around this problem?

    I had tried to apply sorting by length, but it didn’t catch all the problems. I’d still like to have this working, but it’s not a show stopper for me.

    @pixeline, have you looked into this?

    Thanks for the quick response, @pdaengeli.
    I did manage to find the offending piece… it just does a search replace for the particular string, so, if you do sort from the longest to the shortest, I could see how that would work. Going to try it out on my end. Is there anywhere from which to fork this? I found a Git repo, but it’s empty.

    As far as I understand, you could contribute code modifications by opening a ticket in the TRAC repository of the plugin at
    Let me know if you do so, I have a couple of problematic addresses, on which I could test your code.

    Since I couldn’t find a proper fix, I re-ordered the email listing in the content of the page so that came before in the page’s email links. That way the plug-in recognized them as different emails, but it’s not ideal since in my case should come before

    Plugin Author pixeline


    I would need to reproduce the issue to make sure I understand it fully. Can you send me a mail with a sample content that causes the problem?

    alexandre(replace these parentheses with @)



    Thanks for the response.
    To get this problem to trigger, you actually need two similar address (one which is, effectively, a substring of the other).
    Just to continue using the same examples as above, if you were to have two email addresses on the same page:

    “” would be turned into a mailto link in both cases, with the second email having the letters “boo” as just simple html to the left of the “” mailto link.

    The simple suggestion @pdaengeli suggested, which I tested locally and seems to work great, is to sort all of the email addresses in the “pep_replace” function by string length.
    I added the following after the line declaring the “$the_addrs” array and before the “for” statement:
    usort( $the_addrs, function( $a, $b ){
    return strlen( $b ) – strlen( $a );

    This way, as the pep_replace function cycles through emails to find a match, it looks for the longest match first, avoiding matching any substrings within a match.

    I’ll also drop a similar thing in TRAC repo. Thanks for the tip!

    Thank you, @mkranz, this works well.

    Plugin Author pixeline


    Thanks @mkranz, I’ve used your suggestion to patch the plugin. It should trigger an update any time now.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Partly identical addresses may not be caught’ is closed to new replies.