[buddypress-trac] [BuddyPress Trac] #7845: User registration fails if multi-option multi-select or checkbox involved

buddypress-trac noreply at wordpress.org
Sun May 20 13:44:16 UTC 2018


#7845: User registration fails if multi-option multi-select or checkbox involved
--------------------------+--------------------
 Reporter:  DJPaul        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  3.0.1
Component:  Registration  |    Version:
 Severity:  normal        |   Keywords:
--------------------------+--------------------
 This is showing up on the forums:

 * https://buddypress.org/support/topic/buddypress-3-0-no-new-users-
 since/#post-273213
 * https://buddypress.org/support/topic/user-registration-fails-when-
 multiple-options-selected-in-buddypress-3-0-0/

 That second link by @rhwentworth has a good write-up:

 > In BuddyPress 3.0.0, there is a bug insofar as if a registration form is
 submitted and a multi-select or checkbox is involved, and multiple options
 are present, the registration fails with a run-time error  as follows:
 > .
 > Warning: trim() expects parameter 1 to be string, array given in
 /home8/fromchao/public_html/buddypress/wp-content/plugins/buddypress/bp-
 members/screens/register.php on line 93
 > .
 > In my local copy, I patched line 92 to add a check to see if an what was
 returned is an array, and this eliminated the error for me. Might even be
 the right fix, as the individual returns in an array shouldn't need
 trimming.
 > This problem occurred on a dev test site running WordPress 4.9.6. But,
 the problem and its cause seem pretty obvious, and not a function of
 WordPress itself. Just needs to be fixed in the official distribution.

 {{{
 if ( isset( $_POST[ 'field_' . $field_id ] ) and !is_array( $_POST[
 'field_' . $field_id ] ) )  // FIXED!!
 $_POST[ 'field_' . $field_id ] = trim( $_POST[ 'field_' . $field_id ] );
 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7845>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list