[wp-trac] [WordPress Trac] #50181: Second params of get_option() not used
WordPress Trac
noreply at wordpress.org
Fri May 15 15:50:44 UTC 2020
#50181: Second params of get_option() not used
--------------------------------+-----------------------------
Reporter: sebastienserre | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: 5.4.1
Severity: normal | Keywords:
Focuses: |
--------------------------------+-----------------------------
Hello
In a develp=opment I have something like
{{{
$options = get_option( 'my_option', array() );
foreach ( $options as $option ) {
// doing things
}
}}}
The option stored seems to be not unserializable.
So when going through https://github.com/WordPress/WordPress/blob/master
/wp-includes/option.php#L152 + unserialize() which return false on error
the second parameter is not used and we got a Warning.
We're not testing `$options` thinking with the second param setted to
`array()` will allways return an array...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50181>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list