diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index 1b2d29dc3b..d6645c6e0f 100644
--- src/wp-includes/class-wp-customize-manager.php
+++ src/wp-includes/class-wp-customize-manager.php
@@ -480,7 +480,7 @@ final class WP_Customize_Manager {
 			return;
 		}
 
-		if ( ! preg_match( '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/', $this->_changeset_uuid ) ) {
+		if ( ! wp_is_valid_uuid4( $this->_changeset_uuid ) ) {
 			$this->wp_die( -1, __( 'Invalid changeset UUID' ) );
 		}
 
diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 3923ca92ec..1762689c3c 100644
--- src/wp-includes/functions.php
+++ src/wp-includes/functions.php
@@ -5610,6 +5610,17 @@ function wp_generate_uuid4() {
 }
 
 /**
+ * Generate a random UUID (version 4).
+ *
+ * @param string $uuid
+ *
+ * @return bool The string is a valid UUID V4 or false on failure.
+ */
+function wp_is_valid_uuid4( $uuid ) {
+	return preg_match( '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/', $uuid );
+}
+
+/**
  * Get last changed date for the specified cache group.
  *
  * @since 4.7.0
