litespeedtech / lscache_wp

LiteSpeed Cache for WordPress
http://wordpress.org/plugins/litespeed-cache/
GNU General Public License v3.0
218 stars 109 forks source link

Fix PHP Warning: Undefined array key "WC_Widget_Recent_Reviews" #713

Closed Lolosan closed 2 months ago

Lolosan commented 3 months ago

Bear my english

If you have woocommerce widgets disabled (with any of the woo debloaters) ls cache will throw a warning for every new comment

"PHP Warning: Undefined array key "WC_Widget_Recent_Reviews" in /xxx/wp-content/plugins/litespeed-cache/thirdparty/woocommerce.cls.php on line 732"

Maybe use: $recent_reviews = $wp_widget_factory->widgets['WC_Widget_Recent_Reviews'] ?? null; instead of: $recent_reviews = $wp_widget_factory->widgets['WC_Widget_Recent_Reviews'];

szepeviktor commented 3 months ago

Bear my english

It takes just a copy-paste! https://www.deepl.com/en/write

Maybe use:

if (! wc_reviews_enabled()) {
    return;
}
Lolosan commented 3 months ago

I takes just a copy-paste! https://www.deepl.com/en/write

:roll_eyes: Anyway... Glad they fixed it

Lolosan commented 2 months ago

6.4.1 didn't fix it and if i'm not wrong, 7.0 won't either as of now

hi-hai commented 2 months ago

Sorry it seems that PR got lost in new version packing. It now came to v6.4.2 in https://github.com/litespeedtech/lscache_wp/commit/0f3db1e6c7cc1335e75aa33a26d0d630614e6a09 Thanks for following it up @Lolosan

Lolosan commented 2 months ago

@hi-hai Thank you!