Make WordPress Core

Opened 12 years ago

Last modified 5 years ago

#21762 new defect (bug)

Storing a multidimensional array using register_setting double-serializes subarrays identified with a string

Reported by: sekatsim's profile sekatsim Owned by: sekatsim's profile sekatsim
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Database Keywords:
Focuses: Cc:


Storing a multidimensional array, such as $options['my-option'][$id] = "value", into the database using register_setting results in the "my-option" string getting double serialized. The option_value is stored as:


The my-option array is encased in both single and double quotes, so that isset($options['option-id'] evaluates false, but isset($options["'option-id'"] evaluates true.

Change History (4)

#2 @nacin
12 years ago

Why are you serializing the internal array?

#3 @sekatsim
12 years ago

I'm not.. it's automatically serialized whenever someone hits "Save Settings" on an options page and the array is passed through register_setting

#4 @chriscct7
9 years ago

  • Version changed from 3.4.1 to 3.4
Note: See TracTickets for help on using tickets.