Ticket #3240 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

stripslashes in update_usermeta messes up meta_values for arrays/objects

Reported by: stm Assigned to: markjaquith
Priority: normal Milestone:
Component: Administration Version:
Severity: normal Keywords: bug serialize needs-patch
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

10/13/06 23:18:03 changed by stm

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

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

10/14/06 00:09:42 changed by markjaquith

  • keywords changed from bug serialize to bug serialize needs-patch.
  • 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.

10/14/06 05:35:29 changed by markjaquith

  • status changed from assigned to closed.
  • resolution set to fixed.

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

10/14/06 05:35:51 changed by markjaquith

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