Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14604 closed defect (bug) (duplicate)

Objects stored in user meta result in fatal error on wp_update_user()

Reported by: markjaquith Owned by:
Milestone: Priority: normal
Severity: major Version: 3.0.1
Component: Users Keywords:
Focuses: Cc:


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.

Change History (2)

#1 @Denis-de-Bernardy
8 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

/me grumbles #9640 and related tickets.

#2 @nacin
8 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.