Skip to content

Commit

Permalink
Fix SQL error in user_set_fields() with empty array
Browse files Browse the repository at this point in the history
When $p_array is empty, the function generates an invalid SQL query and
throws an error.

Fixes #20574
  • Loading branch information
dregad committed Feb 5, 2016
1 parent 53245f5 commit ccdaf57
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/user_api.php
Expand Up @@ -1539,6 +1539,10 @@ function user_increment_lost_password_in_progress_count( $p_user_id ) {
* @return void
*/
function user_set_fields( $p_user_id, array $p_fields ) {
if( empty( $p_fields ) ) {
return;
}

if( !array_key_exists( 'protected', $p_fields ) ) {
user_ensure_unprotected( $p_user_id );
}
Expand Down

0 comments on commit ccdaf57

Please sign in to comment.