From 8983a4d371763ce221ff1bd1e8b2225d5760e5a8 Mon Sep 17 00:00:00 2001 From: Moon Date: Thu, 13 May 2021 21:46:49 -0700 Subject: [PATCH] Make sure transformers exist (https://github.com/woocommerce/woocommerce-admin/pull/6987) --- .../RemoteInboxNotifications/OptionRuleProcessor.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce-admin/src/RemoteInboxNotifications/OptionRuleProcessor.php b/plugins/woocommerce-admin/src/RemoteInboxNotifications/OptionRuleProcessor.php index b8b62bdab50..ff141636c2e 100644 --- a/plugins/woocommerce-admin/src/RemoteInboxNotifications/OptionRuleProcessor.php +++ b/plugins/woocommerce-admin/src/RemoteInboxNotifications/OptionRuleProcessor.php @@ -72,10 +72,12 @@ class OptionRuleProcessor implements RuleProcessorInterface { return false; } - foreach ( $rule->transformers as $transform_args ) { - $transformer = TransformerService::create_transformer( $transform_args->use ); - if ( ! $transformer->validate( $transform_args->arguments ) ) { - return false; + if ( isset( $rule->transformers ) && is_array( $rule->transformers ) ) { + foreach ( $rule->transformers as $transform_args ) { + $transformer = TransformerService::create_transformer( $transform_args->use ); + if ( ! $transformer->validate( $transform_args->arguments ) ) { + return false; + } } }