[wp-trac] [WordPress Trac] #7383: maybe_serialize() should serialize all non-string values

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 23 12:06:54 GMT 2008

#7383: maybe_serialize() should serialize all non-string values
 Reporter:  DD32     |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  normal   |   Milestone:  2.7      
Component:  General  |     Version:  2.6      
 Severity:  normal   |    Keywords:  has-patch
 update_option('test', 45);
 var_dump( get_option('test') );
 Will output "int 45", However, on subsequent page loads (ie. Once the
 cache is cleared) get_option will return 45 as a string "string '45'"

 The issue is that maybe_serialize only serialises arrays, objects, and
 allready serialized data.[[BR]]
 Integers, Booleans, Floats, etc pass right through, (int)45 !==
 (string)'45' - Which causes problems for plugins which might store a
 boolean, or a integer in a option (And rely upon === for comparisons for

 I've attached a patch which serializes all non-string values, while
 respecting that serialised strings need to be serialized again.

Ticket URL: <http://trac.wordpress.org/ticket/7383>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list