diff --git a/cake/libs/view/helpers/text.php b/cake/libs/view/helpers/text.php index 046ce7080..04e80a812 100644 --- a/cake/libs/view/helpers/text.php +++ b/cake/libs/view/helpers/text.php @@ -123,7 +123,7 @@ class TextHelper extends AppHelper { '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $options . ');'), $text); return preg_replace_callback('#(?)(?tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . strtolower($matches[0]),' . $options . ');'), $text); + create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . $matches[0],' . $options . ');'), $text); } /** diff --git a/cake/tests/cases/libs/view/helpers/text.test.php b/cake/tests/cases/libs/view/helpers/text.test.php index eb674d3e5..7a5470c01 100644 --- a/cake/tests/cases/libs/view/helpers/text.test.php +++ b/cake/tests/cases/libs/view/helpers/text.test.php @@ -267,15 +267,19 @@ class TextHelperTest extends CakeTestCase { $this->assertPattern('#^' . $expected . '$#', $result); $text = 'Text with a partial WWW.cakephp.org URL'; - $expected = 'Text with a partial WWW.cakephp.org URL'; + $expected = 'Text with a partial WWW.cakephp.org URL'; $result = $this->Text->autoLinkUrls($text); $this->assertPattern('#^' . $expected . '$#', $result); $text = 'Text with a partial WWW.cakephp.org © URL'; - $expected = 'Text with a partial WWW.cakephp.org © URL'; + $expected = 'Text with a partial WWW.cakephp.org © URL'; $result = $this->Text->autoLinkUrls($text, array('escape' => false)); $this->assertPattern('#^' . $expected . '$#', $result); + $text = 'Text with a url www.cot.ag/cuIb2Q and more'; + $expected = 'Text with a url www.cot.ag/cuIb2Q and more'; + $result = $this->Text->autoLinkUrls($text); + $this->assertEqual($expected, $result); } /**