XML-RPC: Fix length validation of anonymous commenter's email address.

Fix the first step of validating an anonymous commenters in which the length is checked prior to running regular expressions.

Follow up to [47808].
Fixes #51595.


Built from https://develop.svn.wordpress.org/trunk@49271


git-svn-id: http://core.svn.wordpress.org/trunk@49033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2020-10-22 02:42:06 +00:00
parent 85c49351af
commit 9dc6d6147a
2 changed files with 2 additions and 2 deletions

View File

@ -3913,7 +3913,7 @@ class wp_xmlrpc_server extends IXR_Server {
$comment['user_ID'] = 0; $comment['user_ID'] = 0;
if ( get_option( 'require_name_email' ) ) { if ( get_option( 'require_name_email' ) ) {
if ( strlen( $comment['comment_author_email'] < 6 ) || '' === $comment['comment_author'] ) { if ( strlen( $comment['comment_author_email'] ) < 6 || '' === $comment['comment_author'] ) {
return new IXR_Error( 403, __( 'Comment author name and email are required.' ) ); return new IXR_Error( 403, __( 'Comment author name and email are required.' ) );
} elseif ( ! is_email( $comment['comment_author_email'] ) ) { } elseif ( ! is_email( $comment['comment_author_email'] ) ) {
return new IXR_Error( 403, __( 'A valid email address is required.' ) ); return new IXR_Error( 403, __( 'A valid email address is required.' ) );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.6-beta1-49270'; $wp_version = '5.6-beta1-49271';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.