From f12a68e7c62901df5010d4e505c90c0f54fcb982 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Sun, 12 Oct 2014 00:21:02 +0000 Subject: [PATCH] Differentiate between invalid and missing admin emails when adding a new site Check the emptiness of the admin email before using `sanitize_email()` and `is_email()` to determine if the address is valid. Fixes #17890 git-svn-id: https://develop.svn.wordpress.org/trunk@29877 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/network/site-new.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/network/site-new.php b/src/wp-admin/network/site-new.php index d8024400d5..1a0e6c4450 100644 --- a/src/wp-admin/network/site-new.php +++ b/src/wp-admin/network/site-new.php @@ -49,15 +49,19 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: %s' ), implode( ', ', $subdirectory_reserved_names ) ) ); } - $email = sanitize_email( $blog['email'] ); $title = $blog['title']; if ( empty( $domain ) ) wp_die( __( 'Missing or invalid site address.' ) ); - if ( empty( $email ) ) + + if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { wp_die( __( 'Missing email address.' ) ); - if ( !is_email( $email ) ) + } + + $email = sanitize_email( $blog['email'] ); + if ( ! is_email( $email ) ) { wp_die( __( 'Invalid email address.' ) ); + } if ( is_subdomain_install() ) { $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );