From 5cb20092ce25440d33978d1be32b5c496f1e1617 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 17 Jan 2014 09:31:59 +0000 Subject: [PATCH] make_clickable: When cleaning up accidental links within links, account for the tag being split by newlines. props dd32. fixes #19028. git-svn-id: https://develop.svn.wordpress.org/trunk@26974 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 2 +- tests/phpunit/tests/formatting/MakeClickable.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 27d64e1dc6..ed87b2b8ad 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -1742,7 +1742,7 @@ function make_clickable( $text ) { } // Cleanup of accidental links within links - $r = preg_replace( '#(]+?>|>))]+?>([^>]+?)#i', "$1$3", $r ); + $r = preg_replace( '#(]+?>|>))]+?>([^>]+?)#i', "$1$3", $r ); return $r; } diff --git a/tests/phpunit/tests/formatting/MakeClickable.php b/tests/phpunit/tests/formatting/MakeClickable.php index f6ae895be5..ef55b5c0f1 100644 --- a/tests/phpunit/tests/formatting/MakeClickable.php +++ b/tests/phpunit/tests/formatting/MakeClickable.php @@ -380,4 +380,13 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase { $this->assertEquals( $urls_expected[$key], make_clickable( $url ) ); } } + + /** + * @ticket 19028 + */ + function test_line_break_in_existing_clickable_link() { + $html = "someone@example.com"; + $this->assertEquals( $html, make_clickable( $html ) ); + } }