Index: wp-includes/load.php
===================================================================
--- wp-includes/load.php	(revision 52879)
+++ wp-includes/load.php	(working copy)
@@ -1417,51 +1417,53 @@ function is_ssl() {
 
 		if ( '1' == $_SERVER['HTTPS'] ) {
 			return true;
 		}
 	} elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
 		return true;
 	}
 	return false;
 }
 
 /**
  * Converts a shorthand byte value to an integer byte value.
  *
  * @since 2.3.0
  * @since 4.6.0 Moved from media.php to load.php.
+ * @since 6.1.0 More closely resembles PHP parsing.
  *
  * @link https://www.php.net/manual/en/function.ini-get.php
  * @link https://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
  *
  * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
  * @return int An integer byte value.
  */
 function wp_convert_hr_to_bytes( $value ) {
-	$value = strtolower( trim( $value ) );
-	$bytes = (int) $value;
-
-	if ( false !== strpos( $value, 'g' ) ) {
-		$bytes *= GB_IN_BYTES;
-	} elseif ( false !== strpos( $value, 'm' ) ) {
-		$bytes *= MB_IN_BYTES;
-	} elseif ( false !== strpos( $value, 'k' ) ) {
+	$value = rtrim( $value );
+	$multi = strtolower( substr( $value, -1 ) );
+	$value = rtrim( $value, 'GgMmKk' ); // not technically needed, as intval will skip invalid chars.
+	$bytes = intval( $value, 0 );
+
+	if ( 'g' === $multiplier ) {
+		$bytes *= GB_IN_BYES;
+	} elseif ( 'm' === $multiplier ) {
+		$bytes *= MB_IN_BYES;
+	} elseif ( 'k' === $multiplier ) {
 		$bytes *= KB_IN_BYTES;
 	}
 
-	// Deal with large (float) values which run into the maximum integer size.
-	return min( $bytes, PHP_INT_MAX );
+	return (int) $bytes;
 }
 
 /**
  * Determines whether a PHP ini value is changeable at runtime.
  *
  * @since 4.6.0
  *
  * @link https://www.php.net/manual/en/function.ini-get-all.php
  *
  * @param string $setting The name of the ini setting to check.
  * @return bool True if the value is changeable at runtime. False otherwise.
  */
 function wp_is_ini_value_changeable( $setting ) {
 	static $ini_all;
 
