Upgrade/Install: Use `wp_strip_all_tags()` for the fields in the compare table on the "Update theme/plugin from uploaded zip" screen. Some may contain HTML.

See #9757.
Built from https://develop.svn.wordpress.org/trunk@48453


git-svn-id: http://core.svn.wordpress.org/trunk@48222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2020-07-12 20:00:03 +00:00
parent df2b9b1689
commit 63a2cb3060
3 changed files with 9 additions and 9 deletions

View File

@ -217,17 +217,17 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$is_same_plugin = true; // Let's consider only these rows. $is_same_plugin = true; // Let's consider only these rows.
foreach ( $rows as $field => $label ) { foreach ( $rows as $field => $label ) {
$old_value = ! empty( $current_plugin_data[ $field ] ) ? $current_plugin_data[ $field ] : '-'; $old_value = ! empty( $current_plugin_data[ $field ] ) ? (string) $current_plugin_data[ $field ] : '-';
$new_value = ! empty( $this->upgrader->new_plugin_data[ $field ] ) ? $this->upgrader->new_plugin_data[ $field ] : '-'; $new_value = ! empty( $this->upgrader->new_plugin_data[ $field ] ) ? (string) $this->upgrader->new_plugin_data[ $field ] : '-';
$is_same_plugin = $is_same_plugin && ( $old_value === $new_value ); $is_same_plugin = $is_same_plugin && ( $old_value === $new_value );
$diff_field = ( 'Version' !== $field && $new_value !== $old_value ); $diff_field = ( 'Version' !== $field && $new_value !== $old_value );
$diff_version = ( 'Version' === $field && $this->is_downgrading ); $diff_version = ( 'Version' === $field && $this->is_downgrading );
$table .= '<tr><td class="name-label">' . $label . '</td><td>' . esc_html( $old_value ) . '</td>'; $table .= '<tr><td class="name-label">' . $label . '</td><td>' . wp_strip_all_tags( $old_value ) . '</td>';
$table .= ( $diff_field || $diff_version ) ? '<td class="warning">' : '<td>'; $table .= ( $diff_field || $diff_version ) ? '<td class="warning">' : '<td>';
$table .= esc_html( $new_value ) . '</td></tr>'; $table .= wp_strip_all_tags( $new_value ) . '</td></tr>';
} }
$table .= '</tbody></table>'; $table .= '</tbody></table>';

View File

@ -241,9 +241,9 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
foreach ( $rows as $field => $label ) { foreach ( $rows as $field => $label ) {
$old_value = $current_theme_data->display( $field, false ); $old_value = $current_theme_data->display( $field, false );
$old_value = $old_value ? $old_value : '-'; $old_value = $old_value ? (string) $old_value : '-';
$new_value = ! empty( $this->upgrader->new_theme_data[ $field ] ) ? $this->upgrader->new_theme_data[ $field ] : '-'; $new_value = ! empty( $this->upgrader->new_theme_data[ $field ] ) ? (string) $this->upgrader->new_theme_data[ $field ] : '-';
if ( $old_value === $new_value && '-' === $new_value && 'Template' === $field ) { if ( $old_value === $new_value && '-' === $new_value && 'Template' === $field ) {
continue; continue;
@ -260,9 +260,9 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$new_value .= ' ' . __( '(not found)' ); $new_value .= ' ' . __( '(not found)' );
} }
$table .= '<tr><td class="name-label">' . $label . '</td><td>' . esc_html( $old_value ) . '</td>'; $table .= '<tr><td class="name-label">' . $label . '</td><td>' . wp_strip_all_tags( $old_value ) . '</td>';
$table .= ( $diff_field || $diff_version || $invalid_parent ) ? '<td class="warning">' : '<td>'; $table .= ( $diff_field || $diff_version || $invalid_parent ) ? '<td class="warning">' : '<td>';
$table .= esc_html( $new_value ) . '</td></tr>'; $table .= wp_strip_all_tags( $new_value ) . '</td></tr>';
} }
$table .= '</tbody></table>'; $table .= '</tbody></table>';

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-beta1-48452'; $wp_version = '5.5-beta1-48453';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.