From 864b54d46fbff0ce7f1701aedd467aba404f0d60 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 19 Sep 2015 18:53:25 +0000 Subject: [PATCH] Export: Add late-escaping to the contents of several nodes to avoid creating invalid XML and XML parse errors. Props westonruter. Fixes #33732. Built from https://develop.svn.wordpress.org/trunk@34333 git-svn-id: http://core.svn.wordpress.org/trunk@34297 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/export.php | 65 +++++++++++++++++++----------------- wp-includes/version.php | 2 +- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php index 3acd7fdc3e..6d01a2c2f3 100644 --- a/wp-admin/includes/export.php +++ b/wp-admin/includes/export.php @@ -283,9 +283,9 @@ function export_wp( $args = array() ) { foreach ( $authors as $author ) { echo "\t"; - echo '' . $author->ID . ''; - echo '' . $author->user_login . ''; - echo '' . $author->user_email . ''; + echo '' . intval( $author->ID ) . ''; + echo '' . wxr_cdata( $author->user_login ) . ''; + echo '' . wxr_cdata( $author->user_email ) . ''; echo '' . wxr_cdata( $author->display_name ) . ''; echo '' . wxr_cdata( $author->first_name ) . ''; echo '' . wxr_cdata( $author->last_name ) . ''; @@ -304,7 +304,10 @@ function export_wp( $args = array() ) { return; foreach ( $nav_menus as $menu ) { - echo "\t{$menu->term_id}nav_menu{$menu->slug}"; + echo "\t"; + echo '' . intval( $menu->term_id ) . ''; + echo 'nav_menu'; + echo '' . wxr_cdata( $menu->slug ) . ''; wxr_term_name( $menu ); echo "\n"; } @@ -383,13 +386,13 @@ function export_wp( $args = array() ) { - term_id ?>slug; ?>parent ? $cats[$c->parent]->slug : ''; ?> + term_id ); ?>slug ); ?>parent ? $cats[$c->parent]->slug : '' ); ?> - term_id ?>slug; ?> + term_id ); ?>slug ); ?> - term_id ?>taxonomy; ?>slug; ?>parent ? $terms[$t->parent]->slug : ''; ?> + term_id ); ?>taxonomy ); ?>slug ); ?>parent ? $terms[$t->parent]->slug : '' ); ?> @@ -447,20 +450,20 @@ function export_wp( $args = array() ) { */ echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) ); ?> - ID; ?> - post_date; ?> - post_date_gmt; ?> - comment_status; ?> - ping_status; ?> - post_name; ?> - post_status; ?> - post_parent; ?> - menu_order; ?> - post_type; ?> - post_password; ?> - + ID ); ?> + post_date ); ?> + post_date_gmt ); ?> + comment_status ); ?> + ping_status ); ?> + post_name ); ?> + post_status ); ?> + post_parent ); ?> + menu_order ); ?> + post_type ); ?> + post_password ); ?> + post_type == 'attachment' ) : ?> - ID ); ?> + ID ) ); ?> get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) ); @@ -481,7 +484,7 @@ function export_wp( $args = array() ) { continue; ?> - meta_key; ?> + meta_key ); ?> meta_value ); ?> - comment_ID; ?> + comment_ID ); ?> comment_author ); ?> - comment_author_email; ?> + comment_author_email ); ?> comment_author_url ); ?> - comment_author_IP; ?> - comment_date; ?> - comment_date_gmt; ?> + comment_author_IP ); ?> + comment_date ); ?> + comment_date_gmt ); ?> comment_content ) ?> - comment_approved; ?> - comment_type; ?> - comment_parent; ?> - user_id; ?> + comment_approved ); ?> + comment_type ); ?> + comment_parent ); ?> + user_id ); ?> get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); foreach ( $c_meta as $meta ) : /** @@ -521,7 +524,7 @@ function export_wp( $args = array() ) { } ?> - meta_key; ?> + meta_key ); ?> meta_value ); ?> diff --git a/wp-includes/version.php b/wp-includes/version.php index ba830f2e0f..e60c18eadc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34332'; +$wp_version = '4.4-alpha-34333'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.