From 2963731d2d5e0f5852762a300c26bb68f0a2d1bc Mon Sep 17 00:00:00 2001 From: Jorge Torres Date: Tue, 14 Nov 2023 16:36:39 +0000 Subject: [PATCH 1/2] Prevent possible activation error in `FeaturesController` --- .../Internal/Features/FeaturesController.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/woocommerce/src/Internal/Features/FeaturesController.php b/plugins/woocommerce/src/Internal/Features/FeaturesController.php index 4ff11908ee7..0b6b7006d4c 100644 --- a/plugins/woocommerce/src/Internal/Features/FeaturesController.php +++ b/plugins/woocommerce/src/Internal/Features/FeaturesController.php @@ -7,8 +7,6 @@ namespace Automattic\WooCommerce\Internal\Features; use Automattic\WooCommerce\Internal\Admin\Analytics; use Automattic\WooCommerce\Admin\Features\Navigation\Init; -use Automattic\WooCommerce\Admin\Features\NewProductManagementExperience; -use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController; use Automattic\WooCommerce\Internal\Traits\AccessiblePrivateMethods; use Automattic\WooCommerce\Proxies\LegacyProxy; use Automattic\WooCommerce\Utilities\ArrayUtil; @@ -688,19 +686,21 @@ class FeaturesController { 'id' => empty( $experimental_feature_ids ) ? 'features_options' : 'experimental_features_options', ); - // Allow feature setting properties to be determined dynamically just before being rendered. - $feature_settings = array_map( - function( $feature_setting ) { - foreach ( $feature_setting as $prop => $value ) { - if ( is_callable( $value ) ) { - $feature_setting[ $prop ] = call_user_func( $value ); + if ( $this->verify_did_woocommerce_init() ) { + // Allow feature setting properties to be determined dynamically just before being rendered. + $feature_settings = array_map( + function( $feature_setting ) { + foreach ( $feature_setting as $prop => $value ) { + if ( is_callable( $value ) ) { + $feature_setting[ $prop ] = call_user_func( $value ); + } } - } - return $feature_setting; - }, - $feature_settings - ); + return $feature_setting; + }, + $feature_settings + ); + } return $feature_settings; } From 4ab3d82c6b7a65bdadfc76bfad18a55285b22915 Mon Sep 17 00:00:00 2001 From: Jorge Torres Date: Tue, 14 Nov 2023 16:38:18 +0000 Subject: [PATCH 2/2] Add changelog --- plugins/woocommerce/changelog/fix-41363 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/woocommerce/changelog/fix-41363 diff --git a/plugins/woocommerce/changelog/fix-41363 b/plugins/woocommerce/changelog/fix-41363 new file mode 100644 index 00000000000..16a4c96fef9 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-41363 @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Prevent possible notice during plugin activation.