diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 84a096549d..aeed988ae6 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -408,12 +408,14 @@ function wp_read_image_metadata( $file ) { } } - foreach ( $meta as &$value ) { - if ( is_string( $value ) ) { - $value = wp_kses_post( $value ); + foreach ( $meta['keywords'] as $key => $keyword ) { + if ( ! seems_utf8( $keyword ) ) { + $meta['keywords'][ $key ] = utf8_encode( $keyword ); } } + $meta = wp_kses_post_deep( $meta ); + /** * Filter the array of meta data read from an image's exif data. * diff --git a/wp-includes/kses.php b/wp-includes/kses.php index 0eee02ee2d..527c4cb10f 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -1581,6 +1581,19 @@ function wp_kses_post( $data ) { return wp_kses( $data, 'post' ); } +/** + * Navigates through an array, object, or scalar, and sanitizes content for + * allowed HTML tags for post content. + * + * @since 4.4.2 + * + * @param mixed $value The array or string to filter. + * @return mixed $value The filtered content. + */ +function wp_kses_post_deep( $data ) { + return map_deep( $data, 'wp_kses_post' ); +} + /** * Strips all of the HTML in the content. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 7a32c920e8..3c8a1b64b5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36427'; +$wp_version = '4.5-alpha-36429'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.