Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing linking of emails that are missing tld's. They should not be t…

…urned into links. Test added. Fixes #1622
  • Loading branch information...
commit fbab7bd9c30fe6560bf1581d19f73001a90a4c06 1 parent 2496076
@markstory markstory authored
View
2  cake/libs/view/helpers/text.php
@@ -145,7 +145,7 @@ function autoLinkEmails($text, $options = array()) {
$atom = '[a-z0-9!#$%&\'*+\/=?^_`{|}~-]';
return preg_replace_callback(
- '/(' . $atom . '+(?:\.' . $atom . '+)*@[a-z0-9-]+(?:\.[a-z0-9-]+)*)/i',
+ '/(' . $atom . '+(?:\.' . $atom . '+)*@[a-z0-9-]+(?:\.[a-z0-9-]+)+)/i',
create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "mailto:" . $matches[0],' . $linkOptions . ');'), $text);
}
View
11 cake/tests/cases/libs/view/helpers/text.test.php
@@ -321,6 +321,17 @@ function testAutoLinkEmails() {
}
/**
+ * test invalid email addresses.
+ *
+ * @return void
+ */
+ function testAutoLinkEmailInvalid() {
+ $result = $this->Text->autoLinkEmails('this is a myaddress@gmx-de test');
+ $expected = 'this is a myaddress@gmx-de test';
+ $this->assertEqual($expected, $result);
+ }
+
+/**
* testHighlightCaseInsensitivity method
*
* @access public
Please sign in to comment.
Something went wrong with that request. Please try again.