Make WordPress Core

Opened 20 years ago

Closed 20 years ago

Last modified 20 years ago

#3240 closed defect (bug) (fixed)

stripslashes in update_usermeta messes up meta_values for arrays/objects

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

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)

#1 @stm
20 years ago

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

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

#2 @markjaquith
20 years ago

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

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

#3 @markjaquith
20 years ago

  • Resolutionfixed
  • Status assignedclosed

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

#4 @markjaquith
20 years ago

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

Note: See TracTickets for help on using tickets.