maybe_serialize() should serialize all non-string values
|Reported by:||DD32||Owned by:||anonymous|
|Severity:||trivial||Keywords:||has-patch dev-feedback wont-fix not-a-bug invalid|
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.
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 example).
I've attached a patch which serializes all non-string values, while respecting that serialised strings need to be serialized again.
Change History (12)
comment:10 hakre — 4 years ago
- Cc hanskrentel@… added
- Keywords wont-fix not-a-bug invalid added
- Resolution set to wontfix
- Severity changed from normal to trivial
- Status changed from new to closed