From f69b6a04fbb4db01e72e2a4ab0fc0bde773acf9a Mon Sep 17 00:00:00 2001 From: audrasjb Date: Thu, 25 Nov 2021 08:35:09 +0000 Subject: [PATCH] Media: Replace some array keys with their numeric equivalent. This change replaces `['0']` with `[0]` which brings better consistency, readability and performance. Props chintan1896, adamsilverstein, costdev. Fixes #53540. Built from https://develop.svn.wordpress.org/trunk@52245 git-svn-id: http://core.svn.wordpress.org/trunk@51837 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 12 ++++++------ wp-includes/media.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 186769dd36..816107a3ff 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -3740,17 +3740,17 @@ function wp_get_media_creation_timestamp( $metadata ) { case 'matroska': case 'webm': - if ( isset( $metadata['matroska']['comments']['creation_time']['0'] ) ) { - $creation_date = strtotime( $metadata['matroska']['comments']['creation_time']['0'] ); - } elseif ( isset( $metadata['matroska']['info']['0']['DateUTC_unix'] ) ) { - $creation_date = (int) $metadata['matroska']['info']['0']['DateUTC_unix']; + if ( isset( $metadata['matroska']['comments']['creation_time'][0] ) ) { + $creation_date = strtotime( $metadata['matroska']['comments']['creation_time'][0] ); + } elseif ( isset( $metadata['matroska']['info'][0]['DateUTC_unix'] ) ) { + $creation_date = (int) $metadata['matroska']['info'][0]['DateUTC_unix']; } break; case 'quicktime': case 'mp4': - if ( isset( $metadata['quicktime']['moov']['subatoms']['0']['creation_time_unix'] ) ) { - $creation_date = (int) $metadata['quicktime']['moov']['subatoms']['0']['creation_time_unix']; + if ( isset( $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'] ) ) { + $creation_date = (int) $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix']; } break; } diff --git a/wp-includes/media.php b/wp-includes/media.php index 01543b9dcd..0450b4512f 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1129,7 +1129,7 @@ function wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = f */ function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) { $image = wp_get_attachment_image_src( $attachment_id, $size, $icon ); - return isset( $image['0'] ) ? $image['0'] : false; + return isset( $image[0] ) ? $image[0] : false; } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 0b8bedd8e2..19360d0db3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-52244'; +$wp_version = '5.9-alpha-52245'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.