From b3c9c1615e36a200a308f7bd434eaad5ff4b89b8 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Feb 2015 21:40:50 -0500 Subject: [PATCH] Fix doubly linking URLs starting with // Fixes #5889 --- lib/Cake/Test/Case/View/Helper/TextHelperTest.php | 4 ++++ lib/Cake/View/Helper/TextHelper.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php index 41ef4b296..87d81b14a 100644 --- a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php @@ -127,6 +127,10 @@ class TextHelperTest extends CakeTestCase { $expected = 'Text with a partial www.cakephp.org URL and test@cakephp\.org email address'; $this->assertRegExp('#^' . $expected . '$#', $result); + $text = 'Text with a partial link link'; + $result = $this->Text->autoLink($text, array('escape' => false)); + $this->assertEquals($text, $result); + $text = 'This is a test text with URL http://www.cakephp.org'; $expected = 'This is a test text with URL http://www.cakephp.org'; $result = $this->Text->autoLink($text); diff --git a/lib/Cake/View/Helper/TextHelper.php b/lib/Cake/View/Helper/TextHelper.php index 92d30ace6..2a2a536b4 100644 --- a/lib/Cake/View/Helper/TextHelper.php +++ b/lib/Cake/View/Helper/TextHelper.php @@ -114,7 +114,7 @@ class TextHelper extends AppHelper { $text ); $text = preg_replace_callback( - '#(?)(?)(?