Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#7347 closed defect (bug) (fixed)

maybe_serialize() should serialize strings that are already serialized

Reported by: ryan Owned by:
Milestone: 2.6.1 Priority: normal
Severity: normal Version: 2.6
Component: General Keywords:
Focuses: Cc:

Description (last modified by ryan)

[8100] changed the behavior of maybe_serialize(). Instead of serializing an already serialized string, the string was returned as is. This broke plugins that passed serialized data to update_option()/get_option() expecting it to come back serialized. Instead it came back unserialized.

Change History (4)

#1 @ryan
7 years ago

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

(In [8372]) Don't return if is_string(). Proceed to check if is_serialized(). fixes #7347 for trunk

#2 @ryan
7 years ago

(In [8373]) Don't return if is_string(). Proceed to check if is_serialized(). fixes #7347 for 2.6

#3 @ryan
7 years ago

  • Description modified (diff)

#4 @JonathanRogers
6 years ago

This has to be one of the dumbest things I've come across in a while. Why would it ever be a good idea to serialize an already serialized string? I came across this trying to figure out why custom fields with serialized strings stored in them were showing up doubly serialized.

Specifically, I'd export a page, then import it using the built-in Wordpress UI and the plugin using the custom field no longer worked as intended because the value was doubly serialized. Ticket #4028 seems to indicate this very bug was fixed 2 years ago, only to be re-introduced a year later.

Note: See TracTickets for help on using tickets.