Customize: Add wp_is_uuid() validation function with optional second $version=4 parameter to enforce v4 random UUIDs.

Props jonathanbardo.
Fixes #39778.


git-svn-id: https://develop.svn.wordpress.org/trunk@41388 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter
2017-09-18 23:03:06 +00:00
parent 6c8b9adeee
commit df1bf4a883
3 changed files with 80 additions and 2 deletions

View File

@@ -488,7 +488,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_uuid( $this->_changeset_uuid ) ) {
$this->wp_die( -1, __( 'Invalid changeset UUID' ) );
}