From 4ce5bb55b43d34f023421a41b3ebb857fb81af30 Mon Sep 17 00:00:00 2001 From: "Jorge A. Torres" Date: Wed, 20 Mar 2024 10:12:37 -0300 Subject: [PATCH] Prevent possible type error during `WC_Install::create_options()` (#45730) * Prevent possible type error during `WC_Install::create_options() * Add changelog * document the `woocommerce_get_sections_' . $this->id` filter --------- Co-authored-by: Leif Singer --- .../woocommerce/changelog/fix-type-error-create-options | 4 ++++ .../includes/admin/settings/class-wc-settings-page.php | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/fix-type-error-create-options diff --git a/plugins/woocommerce/changelog/fix-type-error-create-options b/plugins/woocommerce/changelog/fix-type-error-create-options new file mode 100644 index 00000000000..c0f7ef21ce5 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-type-error-create-options @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Prevent possible type error during install routine. diff --git a/plugins/woocommerce/includes/admin/settings/class-wc-settings-page.php b/plugins/woocommerce/includes/admin/settings/class-wc-settings-page.php index 807d9431045..7af5777779c 100644 --- a/plugins/woocommerce/includes/admin/settings/class-wc-settings-page.php +++ b/plugins/woocommerce/includes/admin/settings/class-wc-settings-page.php @@ -163,7 +163,13 @@ if ( ! class_exists( 'WC_Settings_Page', false ) ) : */ public function get_sections() { $sections = $this->get_own_sections(); - return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections ); + /** + * Filters the sections for this settings page. + * + * @since 2.2.0 + * @param array $sections The sections for this settings page. + */ + return (array) apply_filters( 'woocommerce_get_sections_' . $this->id, $sections ); } /**