From 80a5b844a7cf217f9c29c4c5e0f87dc80a06f690 Mon Sep 17 00:00:00 2001 From: Bogdan Ungureanu Date: Fri, 20 Dec 2024 20:46:49 +0200 Subject: [PATCH] RDV: Add a function_exists guard that prevents fatals (#40708) --- .../jetpack-mu-wpcom/changelog/fix-php-fatal-in-wpcom | 4 ++++ .../packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-php-fatal-in-wpcom diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-php-fatal-in-wpcom b/projects/packages/jetpack-mu-wpcom/changelog/fix-php-fatal-in-wpcom new file mode 100644 index 0000000000000..e460fda027a8f --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-php-fatal-in-wpcom @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Add a function_exists guard for wpcom_is_duplicate_views_experiment_enabled function diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 22b6eec4e9fc2..5bbc4ad0e9d6c 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -452,7 +452,7 @@ public static function load_verbum_comments_admin() { * Load Odyssey Stats in Simple sites. */ public static function load_wpcom_simple_odyssey_stats() { - if ( get_option( 'wpcom_admin_interface' ) === 'wp-admin' || wpcom_is_duplicate_views_experiment_enabled() ) { + if ( get_option( 'wpcom_admin_interface' ) === 'wp-admin' || ( function_exists( 'wpcom_is_duplicate_views_experiment_enabled' ) && wpcom_is_duplicate_views_experiment_enabled() ) ) { require_once __DIR__ . '/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php'; } }