mirror of
git://develop.git.wordpress.org/
synced 2025-03-31 10:12:40 +02:00
If the `'widget_testwidget'` option does not exist, `false` was returned from `get_option()`. The `set_up()` logic expects an `array()` and assigns values to keys without checking for an array. The automatic creation of an array (autovivification) triggers a `Deprecated: Automatic conversion of false to array is deprecated in` deprecation notice on PHP 8.1. This commit: - Fixes the deprecation notice by making the default value an empty array. - Moves getting the option within the conditional where it's needed. - Provides a micro-optimization by only getting the options when the conditions are correct for processing. - Makes the code consistent within the `set_up()` for both `get_option()` instances. Follow-up to [51029]. Props jrf, hellofromTonya, BinaryKitten. See #53635. git-svn-id: https://develop.svn.wordpress.org/trunk@51830 602fd350-edb4-49c9-b593-d223f7449a82