Objects stored in user meta result in fatal error on wp_update_user()
|Reported by:||markjaquith||Owned by:|
Storing an object in user meta causes problems when wp_update_user() is called (say, when the user updates their profile).
PHP Catchable fatal error: Object of class stdClass could not be converted to string in /Users/mark/Sites/wp/wp-includes/functions.php on line 1463
The problem is that wp_update_user() does this:
// First, get all of the original fields $user = get_userdata($ID); // Escape data pulled from DB. $user = add_magic_quotes(get_object_vars($user));
And add_magic_quotes() tries to run the object through addslashes() which throws the fatal error.
wp_insert_user() appears to expect slashed data. But it then goes on to call stripslashes_deep(), before throwing the data to wpdb->prepare()
At first glance, removing the add_magic_quotes() call from wp_update_user() and removing the stripslashes_deep() call from wp_insert_user() seems to fix it.