From c6c1ef3c32ee4bfdc86a7dc2290604aee3bc3de8 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 22 Feb 2021 18:55:07 +0000 Subject: [PATCH] Media: Explicitly declare the `$pagenow` global in `wp_get_attachment_url()`. This avoids an "Undefined index" PHP notice in the function when running the `media` test group separately. Follow-up to [32342], [50156], [50164], [50393]. Props johnbillion. Fixes #52606. Built from https://develop.svn.wordpress.org/trunk@50406 git-svn-id: http://core.svn.wordpress.org/trunk@50017 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 4 +++- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index b46d97bf14..93a1b59adf 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -6277,6 +6277,8 @@ function wp_update_attachment_metadata( $attachment_id, $data ) { * @return string|false Attachment URL, otherwise false. */ function wp_get_attachment_url( $attachment_id = 0 ) { + global $pagenow; + $attachment_id = (int) $attachment_id; $post = get_post( $attachment_id ); @@ -6319,7 +6321,7 @@ function wp_get_attachment_url( $attachment_id = 0 ) { } // On SSL front end, URLs should be HTTPS. - if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow'] ) { + if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow ) { $url = set_url_scheme( $url ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 700587f389..5677110ba3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-beta3-50401'; +$wp_version = '5.7-beta3-50406'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.