[wp-trac] [WordPress Trac] #14604: Objects stored in user meta result in fatal error on wp_update_user()

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 12 20:32:53 UTC 2010


#14604: Objects stored in user meta result in fatal error on wp_update_user()
--------------------------+-------------------------------------------------
 Reporter:  markjaquith   |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Users         |     Version:  3.0.1          
 Severity:  major         |    Keywords:                 
--------------------------+-------------------------------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14604>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list