Make WordPress Core


Ignore:
Timestamp:
02/07/2012 09:48:45 PM (12 years ago)
Author:
duck_
Message:

Export valid XML by escaping the closing CDATA sequence "]]>". Props ceefour. See #15203.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/export.php

    r19784 r19858  
    118118     *
    119119     * @param string $str String to wrap in XML CDATA tag.
     120     * @return string
    120121     */
    121122    function wxr_cdata( $str ) {
     
    124125
    125126        // $str = ent2ncr(esc_html($str));
    126         $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>';
     127        $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
    127128
    128129        return $str;
Note: See TracChangeset for help on using the changeset viewer.