Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.58k stars 797 forks source link

Subscriptions: Investigate potential fatal #26178

Closed kraftbj closed 1 year ago

kraftbj commented 2 years ago

Impacted plugin

Jetpack

Steps to Reproduce

A clear and concise description of what you expected to happen.

No fatals.

What actually happened

[12-Sep-2022 18:55:45 UTC] PHP Fatal error:  Uncaught Error: Class "Jetpack_Subscriptions_Widget" not found in /usr/local/src/jetpack-monorepo/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/subscribers.php:67

Browser

No response

Other information

My guess is something with Developer mode disabling the subscriptions module, but either a block always expects it or doesn't realize it won't ba available, and the rest endpoint class doesn't sufficiently ensure the class is available before trying to use it.

Platform (Simple, Atomic, or both?)

No response

Reproducibility

Consistent

Severity

One

Available workarounds?

No response

Workaround details

No response

iandunn commented 1 year ago

I'm seeing this on various sites in a production Multisite too, so there may be additional causes beyond offline mode. I'll wait and see if installing v11.4 fixes it, though 👍🏻

E_ERROR: Uncaught Error: Class 'Jetpack_Subscriptions_Widget' not found in /wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/subscribers.php:67
URL: https://kolkata.wordcamp.org/2022/wp-json/wpcom/v2/subscribers/count?_locale=user
Referer: https://kolkata.wordcamp.org/2022/wp-admin/post.php?post=653&action=edit&classic-editor__forget
katiebethbrown commented 1 year ago

Reopening as we've run into this on a Team51 site.

In our case the site has a Subscription block in the Footer widget area. The site was cloned, and the clone had a Site connection but no Account connection. Without the Account connection we get the fatal. Removing the Subscription block or creating the Account connection resolves the fatal, but I'd expected it to fail gracefully.

I can reliably replicate on a Jurassic Ninja site as well. If I setup the Jetpack connection (Site and Account), add a subscribe block in a widget and then break the Account connection I get the fatal:

Fatal error: Uncaught Error: Class "Jetpack_Subscriptions_Widget" not found in /srv/users/usere8d75201/apps/usere8d75201/public/wp-content/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php:451

CleanShot 2023-06-28 at 18 41 33@2x

jeherve commented 1 year ago

@katiebethbrown Good catch, thanks a lot for the reproduction steps! I opened #31635 to take care of that.