From bd87ef45f2b36e35e806082623792d91b30ca639 Mon Sep 17 00:00:00 2001 From: euromark Date: Fri, 27 Sep 2013 15:01:46 +0200 Subject: [PATCH] complete autoLinkEmail() --- lib/Cake/Test/Case/View/Helper/TextHelperTest.php | 5 +++++ lib/Cake/View/Helper/TextHelper.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php index e620c13b970..2fc6f21ab7e 100644 --- a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php @@ -364,6 +364,11 @@ public function testAutoLinkEmails() { $expected = 'Text with düsentrieb@küchenschöhn-not-working.de address'; $result = $this->Text->autoLinkEmails($text); $this->assertRegExp('#^' . $expected . '$#', $result); + + $text = 'Text with me@subdomain.küchenschöhn.de address'; + $expected = 'Text with me@subdomain.küchenschöhn.de address'; + $result = $this->Text->autoLinkEmails($text); + $this->assertRegExp('#^' . $expected . '$#', $result); } /** diff --git a/lib/Cake/View/Helper/TextHelper.php b/lib/Cake/View/Helper/TextHelper.php index b979ec61771..ffa89b54361 100644 --- a/lib/Cake/View/Helper/TextHelper.php +++ b/lib/Cake/View/Helper/TextHelper.php @@ -188,7 +188,7 @@ public function autoLinkEmails($text, $options = array()) { $atom = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]'; $text = preg_replace_callback( - '/(' . $atom . '+(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[a-z0-9-]+)+)/ui', + '/(' . $atom . '+(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[\p{L}0-9-]+)+)/ui', array(&$this, '_insertPlaceholder'), $text );