I saw the same thing in other functions. Some research I discovered that “id” (lower case) is not generated automatically in all cases. I’ve solved without having to overwrite functions if after cleaning the cache so as to put ID (uppercase).
// This throw the error
wp_cache_delete($_POST[“userid”], ‘users’);
$current_user = get_userdata($_POST[“userid”]);
// this work without overwritter
wp_cache_delete($_POST[“userid”], ‘users’);
$current_user = get_userdata($_POST[“userid”]);
$current_user->id = $current_user->ID;