Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email cloaking does not work with & in text #4263

Closed
heleneross opened this issue Sep 10, 2014 · 2 comments
Closed

email cloaking does not work with & in text #4263

heleneross opened this issue Sep 10, 2014 · 2 comments

Comments

@heleneross
Copy link

Steps to reproduce the issue

create an email address with an html entity in the text of the anchor

<a href="mailto:somebody@somewhere.com">Fred&amp;Tom@somewhere.com</a>

Expected result

Fred&Tom@somewhere.com

Actual result

Fred&amp;Tom@somewhere.com

System information (as much as possible)

J3.3.3

Additional comments

function convertEncoding($text) in libraries/cms/html/email.php seems to be the culprit as it replaces vowels in the text (and also in the entities).

I did a quick kludge by changing this function to:

protected static function convertEncoding($text)
    {
        $text = html_entity_decode($text);

        // Replace vowels with character encoding
        $text = str_replace('a', '&#97;', $text);
        $text = str_replace('e', '&#101;', $text);
        $text = str_replace('i', '&#105;', $text);
        $text = str_replace('o', '&#111;', $text);
        $text = str_replace('u', '&#117;', $text);

        $text = htmlentities($text,ENT_QUOTES,'UTF-8',false);

        return $text;
    }

seems to work but I have probably broken something else!

@n9iels
Copy link
Contributor

n9iels commented Sep 11, 2014

Bug confirmed and the suggested fix worked fine for me. I create a PR for this so we can test it and, if everything seems fine, merged it into staging

@infograf768
Copy link
Member

Good find! Merged. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants