[wp-trac] [WordPress Trac] #30926: ]]> replaced with ]]> by the_content() not always desirable

WordPress Trac noreply at wordpress.org
Tue Jan 6 03:58:40 UTC 2015


#30926: ]]> replaced with ]]> by the_content() not always desirable
--------------------------+-----------------------------
 Reporter:  jqz           |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Formatting    |    Version:  4.1
 Severity:  normal        |   Keywords:
  Focuses:  javascript    |
--------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30926>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list