[wp-trac] [WordPress Trac] #31992: sanitize_email() and is_email() preg_replace/preg_match problems

WordPress Trac noreply at wordpress.org
Thu Apr 16 14:08:53 UTC 2015


#31992: sanitize_email() and is_email() preg_replace/preg_match problems
--------------------------+-----------------------------
 Reporter:  ysalame       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Formatting    |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Tested against trunk (2015-04-16)

 '''Test case'''
 {{{
 $target_email = 'dummy-email.y.!#$%@gmail.com';
 echo $target_email.'<br>';
 echo sanitize_email($target_email).'<br>';
 echo 'is_email : '.is_email($target_email);
 }}}

 '''Return'''
 {{{
 dummy-email.y.!#$%@gmail.com
 dummy-email.y.!#$%@gmail.com
 is_email : dummy-email.y.!#$%@gmail.com
 }}}


 Function is_email @ /wp-includes/formatting.php line 2177
 Preg_replace @ line 2211 is not correct.
 {{{
 if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
 }}}

 Function sanitize_email() @ /wp-includes/formatting.php line 2430
 Preg_replace @ line 2460 is not correct.
 {{{
 $local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local
 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31992>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list