From fa0acbe3bb065153a7f7219f112bb0841c021dfb Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 10 Sep 2014 21:57:15 +0000 Subject: [PATCH] Don't overwrite the `length` property unnecessarily when generating metadata for audio and video files. Props jrf, wonderboymusic. Fixes #29176. Built from https://develop.svn.wordpress.org/trunk@29728 git-svn-id: http://core.svn.wordpress.org/trunk@29502 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index e13fc17704..f9962827de 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2860,7 +2860,7 @@ function wp_add_id3_tag_data( &$metadata, $data ) { foreach ( array( 'id3v2', 'id3v1' ) as $version ) { if ( ! empty( $data[$version]['comments'] ) ) { foreach ( $data[$version]['comments'] as $key => $list ) { - if ( ! empty( $list ) ) { + if ( 'length' !== $key && ! empty( $list ) ) { $metadata[$key] = reset( $list ); // Fix bug in byte stream analysis. if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) ) @@ -2922,7 +2922,7 @@ function wp_read_video_metadata( $file ) { if ( ! empty( $data['mime_type'] ) ) $metadata['mime_type'] = $data['mime_type']; if ( ! empty( $data['playtime_seconds'] ) ) - $metadata['length'] = (int) ceil( $data['playtime_seconds'] ); + $metadata['length'] = (int) round( $data['playtime_seconds'] ); if ( ! empty( $data['playtime_string'] ) ) $metadata['length_formatted'] = $data['playtime_string']; if ( ! empty( $data['video']['resolution_x'] ) ) @@ -2978,7 +2978,7 @@ function wp_read_audio_metadata( $file ) { if ( ! empty( $data['mime_type'] ) ) $metadata['mime_type'] = $data['mime_type']; if ( ! empty( $data['playtime_seconds'] ) ) - $metadata['length'] = (int) ceil( $data['playtime_seconds'] ); + $metadata['length'] = (int) round( $data['playtime_seconds'] ); if ( ! empty( $data['playtime_string'] ) ) $metadata['length_formatted'] = $data['playtime_string'];