Tonya Mork
cece2cca5e
REST API: Fix autovivification deprecation notice in WP_Test_REST_Widgets_Controller::set_up().
...
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
2021-09-20 18:48:47 +00:00
..
2021-08-31 17:22:32 +00:00
2021-09-10 17:26:42 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-08-26 19:09:16 +00:00
2021-08-07 10:29:41 +00:00
2021-08-09 19:08:09 +00:00
2021-08-26 12:57:08 +00:00
2021-08-26 12:57:08 +00:00
2021-08-30 15:19:38 +00:00
2021-08-07 10:40:44 +00:00
2021-08-07 10:29:41 +00:00
2021-09-10 16:29:24 +00:00
2021-08-26 12:57:08 +00:00
2021-08-20 16:11:04 +00:00
2021-08-21 15:32:53 +00:00
2021-02-11 20:53:51 +00:00
2021-08-22 10:07:17 +00:00
2021-08-07 10:29:41 +00:00
2021-08-16 22:16:32 +00:00
2021-09-09 22:43:49 +00:00
2021-08-09 17:19:21 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-08-31 18:57:09 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-08-26 12:57:08 +00:00
2021-08-07 10:29:41 +00:00
2021-07-06 20:20:51 +00:00
2021-07-05 17:21:53 +00:00
2021-08-26 12:57:08 +00:00
2021-08-07 10:29:41 +00:00
2021-08-09 19:08:09 +00:00
2021-08-09 19:08:09 +00:00
2021-09-15 22:18:36 +00:00
2021-08-17 20:01:15 +00:00
2021-08-26 12:57:08 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-09-20 18:48:47 +00:00
2021-08-07 10:29:41 +00:00
2021-07-26 19:09:41 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-08-11 09:06:31 +00:00
2020-11-15 13:59:32 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:40:44 +00:00
2021-08-16 20:16:13 +00:00
2021-08-09 19:08:09 +00:00
2021-08-31 17:22:32 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-08-06 21:52:06 +00:00
2021-02-05 03:36:26 +00:00
2021-08-26 12:57:08 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-08-26 12:57:08 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-08-09 19:08:09 +00:00
2021-08-10 17:34:30 +00:00
2021-08-26 12:57:08 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-07-10 11:15:44 +00:00
2021-08-07 10:29:41 +00:00
2021-07-11 12:41:48 +00:00
2021-08-24 20:50:21 +00:00
2021-08-26 12:57:08 +00:00
2021-08-26 12:57:08 +00:00
2021-07-10 11:15:44 +00:00
2021-07-19 14:00:11 +00:00
2021-08-09 19:08:09 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-09-15 19:05:20 +00:00
2021-08-07 10:29:41 +00:00
2021-08-07 10:29:41 +00:00
2021-07-12 10:35:44 +00:00
2021-08-09 19:08:09 +00:00
2021-08-07 10:29:41 +00:00
2021-08-20 23:43:21 +00:00
2021-08-07 10:29:41 +00:00
2021-08-26 12:57:08 +00:00
2021-08-07 10:29:41 +00:00
2020-11-15 13:59:32 +00:00
2021-07-15 14:44:22 +00:00
2021-08-07 10:29:41 +00:00
2021-07-18 14:10:24 +00:00
2021-08-07 14:18:31 +00:00
2021-08-09 19:08:09 +00:00
2021-08-07 10:29:41 +00:00
2021-09-07 21:30:07 +00:00
2021-08-07 10:29:41 +00:00
2021-09-09 21:39:39 +00:00
2021-08-07 10:29:41 +00:00