From 698f77735b911ad2bcaec9925fc0d0c66e000376 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 10 Sep 2014 21:56:24 +0000 Subject: [PATCH] Don't overwrite the `length` property unnecessarily when generating metadata for audio and video files. Props jrf, wonderboymusic. Fixes #29176. git-svn-id: https://develop.svn.wordpress.org/trunk@29728 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/media.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index e13fc17704..f9962827de 100644 --- a/src/wp-admin/includes/media.php +++ b/src/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'];