WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3240 closed defect (bug) (fixed)

stripslashes in update_usermeta messes up meta_values for arrays/objects

Reported by: stm Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords: bug serialize needs-patch
Focuses: Cc:

Description

the change made in rev [4382] caused a problem when trying to set a non-string as a meta_value.
There should be a check made to see if the object is a string before doing a stripslashes.

ie.

if ( !is_array($meta_value) && !is_object($meta_value) )
    $meta_value = stripslashes($meta_value);

I found this because it was making the Administrator capabilites be 'Array' in the db instead of the serialized array of capabilities it was supposed to be set to.

Change History (4)

comment:1 @stm8 years ago

sorry, forgot to mention the file it's in:

source:trunk/wp-includes/user.php@4383#L118

comment:2 @markjaquith8 years ago

  • Keywords needs-patch added
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Eek, good catch. I think there's one other place this has to be fixed. I'll get that taken care of later tonight.

comment:3 @markjaquith8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [4395]) Only run stripslashes() on strings in update_usermeta(). Props stm. fixes #3240

comment:4 @markjaquith8 years ago

(In [4396]) Only run stripslashes() on strings in update_usermeta(). Props stm. fixes #3240

Note: See TracTickets for help on using tickets.