[wp-trac] [WordPress Trac] #44672: REST-API: invalid email on lowercase/uppercase change

WordPress Trac noreply at wordpress.org
Tue Jul 31 12:12:03 UTC 2018


#44672: REST-API: invalid email on lowercase/uppercase change
------------------------------------------+------------------------------
 Reporter:  fuchsws                       |       Owner:  (none)
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  REST API                      |     Version:  4.9.7
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by subrataemfluence):

 Can we simply `unslash` and then `sanitize` the value like

 {{{#!php
 <?php
 if ( email_exists( sanitize_text_field( wp_unslash( $request['email'] ) )
 ) && sanitize_text_field( wp_unslash( $request['email'] ) ) !==
 $user->user_email ) {
    return new WP_Error( 'rest_user_invalid_email', __( 'Invalid email
 address.' ), array( 'status' => 400 ) );
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44672#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list