From ccdaf5790f751dc5712f9640ef9af60541b124a0 Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Fri, 5 Feb 2016 23:57:01 +0100 Subject: [PATCH] Fix SQL error in user_set_fields() with empty array When $p_array is empty, the function generates an invalid SQL query and throws an error. Fixes #20574 --- core/user_api.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/user_api.php b/core/user_api.php index 3d3fd869cd..ebd2281ff6 100644 --- a/core/user_api.php +++ b/core/user_api.php @@ -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 ); }