From 6453744625bce1c89fda39add54d1eb990d42f74 Mon Sep 17 00:00:00 2001 From: haqadn Date: Fri, 21 Jun 2024 08:23:30 +0000 Subject: [PATCH] Super Cache: Avoid a PHP warning about converting false to array (#37968) * Avoid a "false -> array" deprecated PHP notice. * changelog * Have phan! --------- Co-authored-by: Adnan Haque Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/9610429042 Upstream-Ref: Automattic/jetpack@f397fd8da7ac5ca168e6ed05ecd2c8271fd447bb --- CHANGELOG.md | 1 + wp-cache.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca84a28e..c14a7f7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This is an alpha version! The changes listed here are not final. ### Fixed - Super Cache: Align detection of Boost installs with activation of that plugin +- Super Cache: fixed a PHP warning when deactivating the plugin. - Super Cache: make sure plugins links is an array before using it. - Super Cache: remove the preload interval based on the post count. Preload as often as you want. diff --git a/wp-cache.php b/wp-cache.php index 3eb44d6c..f494235f 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -3741,7 +3741,7 @@ function wp_cache_disable_plugin( $delete_config_file = true ) { } uninstall_supercache( WP_CONTENT_DIR . '/cache' ); - $file_not_deleted = false; + $file_not_deleted = array(); wpsc_remove_advanced_cache(); if ( @file_exists( WP_CONTENT_DIR . "/advanced-cache.php" ) ) { $file_not_deleted[] = WP_CONTENT_DIR . '/advanced-cache.php'; @@ -3750,7 +3750,7 @@ function wp_cache_disable_plugin( $delete_config_file = true ) { if ( false == unlink( WPCACHECONFIGPATH . "/wp-cache-config.php" ) ) $file_not_deleted[] = WPCACHECONFIGPATH . '/wp-cache-config.php'; } - if ( $file_not_deleted ) { + if ( ! empty( $file_not_deleted ) ) { $msg = __( "Dear User,\n\nWP Super Cache was removed from your blog or deactivated but some files could\nnot be deleted.\n\n", 'wp-super-cache' ); foreach( (array)$file_not_deleted as $path ) { $msg .= "{$path}\n";