From facdb7e8867625053bab43790cffb27b037bb272 Mon Sep 17 00:00:00 2001
From: Paul Biron <paul@sparrowhawkcomputing.com>
Date: Tue, 19 Jul 2022 16:57:27 -0600
Subject: [PATCH] Same as 48116.5 except that: 1) it sorts the PHP extenions in
 case-insensitive manner, and 2) fixes a few WPCS problems.

---
 src/wp-includes/update.php | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php
index 04c8aa3ec2..bc295359bf 100644
--- a/src/wp-includes/update.php
+++ b/src/wp-includes/update.php
@@ -89,6 +89,8 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
 		$wp_install        = home_url( '/' );
 	}
 
+	$extensions = get_loaded_extensions();
+	sort( $extensions, SORT_STRING | SORT_FLAG_CASE );
 	$query = array(
 		'version'            => $wp_version,
 		'php'                => $php_version,
@@ -99,8 +101,42 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
 		'users'              => get_user_count(),
 		'multisite_enabled'  => $multisite_enabled,
 		'initial_db_version' => get_site_option( 'initial_db_version' ),
+		'extensions'         => array_combine( $extensions, array_map( 'phpversion', $extensions ) ),
+		'platform_flags'     => array(
+			'os'   => PHP_OS,
+			'bits' => PHP_INT_SIZE === 4 ? 32 : 64,
+		),
+		'image_support'      => array(),
 	);
 
+	if ( function_exists( 'gd_info' ) ) {
+		$gd_info = gd_info();
+		// Filter to supported values.
+		$gd_info = array_filter( $gd_info );
+
+		// Add data for GD WebP and AVIF support.
+		$query['image_support']['gd'] = array_keys(
+			array_filter(
+				array(
+					'webp' => isset( $gd_info['WebP Support'] ),
+					'avif' => isset( $gd_info['AVIF Support'] ),
+				)
+			)
+		);
+	}
+
+	if ( class_exists( 'Imagick' ) ) {
+		// Add data for Imagick WebP and AVIF support.
+		$query['image_support']['imagick'] = array_keys(
+			array_filter(
+				array(
+					'webp' => ! empty( Imagick::queryFormats( 'WEBP' ) ),
+					'avif' => ! empty( Imagick::queryFormats( 'AVIF' ) ),
+				)
+			)
+		);
+	}
+
 	/**
 	 * Filters the query arguments sent as part of the core version check.
 	 *
-- 
2.30.2.windows.1

