From 9fabda744ae49099a525c8e54632adfe91f22f61 Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Sat, 26 Nov 2022 05:52:11 +0530 Subject: [PATCH] Modified get_wp_plugin_id() (#35727) * Modified get_wp_plugin_id() * Changelog. * Use strict comparison per project coding standards. Co-authored-by: barryhughes <3594411+barryhughes@users.noreply.github.com> --- plugins/woocommerce/changelog/fix-35727-plugin-id | 4 ++++ plugins/woocommerce/src/Utilities/PluginUtil.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/fix-35727-plugin-id diff --git a/plugins/woocommerce/changelog/fix-35727-plugin-id b/plugins/woocommerce/changelog/fix-35727-plugin-id new file mode 100644 index 00000000000..355495e915e --- /dev/null +++ b/plugins/woocommerce/changelog/fix-35727-plugin-id @@ -0,0 +1,4 @@ +Significance: patch +Type: tweak + +Improves efficiency of code responsible for determining plugin IDs (during feature compatibility checks). diff --git a/plugins/woocommerce/src/Utilities/PluginUtil.php b/plugins/woocommerce/src/Utilities/PluginUtil.php index b0b24cacde0..6126de80d7c 100644 --- a/plugins/woocommerce/src/Utilities/PluginUtil.php +++ b/plugins/woocommerce/src/Utilities/PluginUtil.php @@ -129,7 +129,7 @@ class PluginUtil { // Try to match plugin_basename(). $plugin_basename = $this->proxy->call_function( 'plugin_basename', $plugin_file ); - if ( array_key_exists( $plugin_basename, $wp_plugins ) ) { + if ( in_array( $plugin_basename, $wp_plugins, true ) ) { return $plugin_basename; }