Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#30926 closed defect (bug) (duplicate)

]]> replaced with ]]> by the_content() not always desirable

Reported by: jqz's profile jqz Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: Formatting Keywords:
Focuses: javascript Cc:

Description

Line 222 of wp-includes/post-template.php is the clear culprit:

$content = str_replace( ']]>', ']]>', $content );

This causes issues when such replacement is not desired, for example some generated Javascript to obfuscate an email address may result in this particular combination of characters within a string, and this str_replace will break it.

The combination marks the end of a CDATA section, and there was undoubtedly a reason for this line of code, but no comment is provided (is there a changelog description?), so it's not clear if it is still required. I note there is no corresponding code matching and replacing <![CDATA[ ...?

At a minimum, this string replacement should be done by a filter (priority 100+ to run last) so that it can be easily disabled if required. Any knowledge of why it exists should also be documented. If it can be safely removed entirely, so much the better.

Change History (1)

#1 @SergeyBiryukov
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #3670 and #27134.

Note: See TracTickets for help on using tickets.