Make WordPress Core

Opened 21 years ago

Closed 19 years ago

Last modified 19 years ago

#1412 closed defect (bug) (wontfix)

Object unserialization using get_option fails

Reported by: ericanderson's profile EricAnderson Owned by: westi's profile westi
Milestone: Priority: normal
Severity: normal Version: 1.5.1.1
Component: General Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

Basically, the object is serialized fine, however the code that retreives all the options, unserializes the object as soon as its retrieved from the DB, but since that code happens long before the plugin code is loaded, the class definition is non existant.

The 'correct' way to handle this, would be to not unserialize until the coder calls get_option, in this case, the class definition would be loaded and there would be more problems.

I originally laid out this problem here: http://ericanderson.us/blog/2005-03-08/hacking-wordpresss-get_option-object-unserialization/

Attachments (1)

1412.diff (632 bytes) - added by westi 20 years ago.
The worlds shortest patch

Download all attachments as: .zip

Change History (6)

#1 @westi
20 years ago

  • Milestone set to 2.0.3
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Looking at this and the code I think all we need do here is remove the maybe_unserialize}} from {{{get_alloptions as get_setting does this anyways .

This way unserialization will be done on the get_option call.

We may want to recache the unserialized value in get_settings the first time an option value is asked for if we feel that unserializing _every_ time is too expensive an option - which the only reason for doing it get_alloptions that I can think of.

@westi
20 years ago

The worlds shortest patch

#2 @westi
20 years ago

  • Component changed from Administration to General
  • Keywords bg|has-patch bg|2nd-opinion added
  • Milestone changed from 2.0.3 to 2.1

#3 @Nazgul
19 years ago

  • Keywords has-patch 2nd-opinion added; bg|has-patch bg|2nd-opinion removed

#4 @matt
19 years ago

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

#5 @Nazgul
19 years ago

  • Milestone 2.1 deleted
Note: See TracTickets for help on using tickets.