Bug in wp_update_user?
-
Hello,
I have some custom-rolled code that is called wp_update_user to update the user info in the database.
However, I was receiving A Fatal error (invalid argument in ForEach).
I tracked the problem down to the following line:
$user = add_magic_quotes(get_object_vars($user));
It appears that $user (which is set earlier in the function by pulling the fields from the database), is already an array, so using get_object_vars on it, makes it cease to be an array (at least it did in my case).
Replacing the above line with
if (is_array($user)) {
$user = add_magic_quotes(($user));
} else {
$user = add_magic_quotes(get_object_vars($user))
}Solved the problem.
Is this really a bug? If not, what was causing the problem? Other than for the fix above, I have *NOT* altered any WordPress core files.
Cheers,
John
- The topic ‘Bug in wp_update_user?’ is closed to new replies.