diff --git src/wp-includes/formatting.php src/wp-includes/formatting.php
index e690948..1727c72 100644
|
|
function wp_rel_nofollow_callback( $matches ) { |
3040 | 3040 | function wp_targeted_link_rel( $text ) { |
3041 | 3041 | // Don't run (more expensive) regex if no links with targets. |
3042 | 3042 | if ( stripos( $text, 'target' ) !== false && stripos( $text, '<a ' ) !== false ) { |
3043 | | $text = preg_replace_callback( '|<a\s([^>]*target\s*=[^>]*)>|i', 'wp_targeted_link_rel_callback', $text ); |
| 3043 | if ( ! is_serialized( $text ) ) { |
| 3044 | $text = preg_replace_callback( '|<a\s([^>]*target\s*=[^>]*)>|i', 'wp_targeted_link_rel_callback', $text ); |
| 3045 | } |
3044 | 3046 | } |
3045 | 3047 | |
3046 | 3048 | return $text; |
diff --git tests/phpunit/tests/formatting/WPTargetedLinkRel.php tests/phpunit/tests/formatting/WPTargetedLinkRel.php
index 08f8ac1..929c04f 100644
|
|
class Tests_Targeted_Link_Rel extends WP_UnitTestCase { |
101 | 101 | |
102 | 102 | $this->assertEquals( $expected, $post->post_content ); |
103 | 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Ensure entirely serialized content is ignored. |
| 107 | * |
| 108 | * @ticket 46402. |
| 109 | */ |
| 110 | public function test_ignore_entirely_serialized_content() { |
| 111 | $content = 'a:1:{s:4:"html";s:52:"<p>Links: <a href="/" target="_blank">No Rel</a></p>";}'; |
| 112 | $expected = 'a:1:{s:4:"html";s:52:"<p>Links: <a href="/" target="_blank">No Rel</a></p>";}'; |
| 113 | $this->assertEquals( $expected, wp_targeted_link_rel( $content ) ); |
| 114 | } |
| 115 | |
104 | 116 | } |