[wp-trac] [WordPress Trac] #59588: False returned instead of default value on get_option with failure of unserializing data.
WordPress Trac
noreply at wordpress.org
Thu Apr 9 06:42:08 UTC 2026
#59588: False returned instead of default value on get_option with failure of
unserializing data.
--------------------------------------+------------------------------
Reporter: cweberDC | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 6.3.2
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Comment (by kalpeshh):
I've created a patch for this issue.
The fix saves the raw DB value before calling `maybe_unserialize()`, then
checks if unserialization failed (result is `false`, value was serialized,
and value is not `b:0;` — the valid serialization of boolean `false`). In
that case, `$default_value` is returned instead.
Two tests are included: one for corrupted serialized data returning the
default, and one confirming a legitimately stored `false` still returns
`false`.
PR: https://github.com/WordPress/wordpress-develop/pull/11500
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59588#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list