Jetpack activation fatals with Heartbeat::get_active_plugins() undefined when WooCommerce's older bundled connection package is already loaded

Open
#52,385 2 comments 1 reaction 1 assignee View on GitHub

Maintainers usually reply within 1 day

@jamesckemp is already working on this.

Since Sep 29, 2026.

Assessment

This issue has not been assessed yet.

Description

Impacted plugin

Jetpack (plugin build 16.3-a.1 as served by Pressable's platform channel; the connection package involved is automattic/jetpack-connection 8.7.9 or later)

Quick summary

wp plugin activate jetpack on a site where WooCommerce 10.9.4 is already active dies inside the activation hook with:

Call to undefined method Automattic\Jetpack\Heartbeat::get_active_plugins()

Heartbeat::get_active_plugins() was added to the connection package in 8.7.9 (2026-07-20, #50006) and is called from class.jetpack.php. WooCommerce 10.9.4 (2026-07-07) bundles automattic/jetpack-connection v6.19.2 and automattic/jetpack-autoloader v5.0.0, which predate it. When Jetpack's activation hook runs, the Heartbeat class that is already loaded in the request is WooCommerce's 6.19.2 copy, and PHP cannot swap it for Jetpack's own newer package. On the next normal page load the autoloader selects Jetpack's package and everything works, so this only bites during activation.

Steps to reproduce
  1. Site with WooCommerce 10.9.4 active and Jetpack installed but inactive. Seen on a Pressable staging site, WordPress 7.1, PHP 8.5.10, Jetpack 16.3-a.1 installed by the platform.
  2. wp plugin activate jetpack
  3. Observe the fatal above and the activation aborting.
  4. wp --skip-plugins=woocommerce plugin activate jetpack succeeds. Subsequent loads with both plugins active are fine.

Honest caveat: an earlier activation on the same site with the same WooCommerce and Jetpack versions did not fatal. I have one reproduction and one non-reproduction and did not establish the difference. A plausible one is whether WooCommerce had already instantiated Heartbeat earlier in that request, since the failure needs the old class to be loaded before Jetpack's hook runs.

Site owner impact

Activating Jetpack from WP-CLI, or from any code path that activates it while WooCommerce is already active, fails with a fatal until the operator knows to skip WooCommerce for that one command. The site keeps serving; the activation is what aborts. This is the common order of operations after any full-database push that resets active_plugins.

Severity

Medium

What other impact(s) does this issue have?

Any other plugin that bundles a connection package older than 8.7.9 can produce the same result. Admin-UI activation was not tested; the autoloader has request-action detection for that path that WP-CLI does not trigger, so the two may differ.

If a workaround is available, please outline it here.

wp --skip-plugins=woocommerce plugin activate jetpack, then load the site normally.

Suggested fix on the Jetpack side: guard the activation-time call with method_exists( Heartbeat::class, 'get_active_plugins' ), or defer the environment-stats work out of the activation hook to the next load, when the autoloader has selected Jetpack's own package.

Platform (Simple and/or Atomic)

Neither. Pressable-hosted site (self-hosted-style install with the platform-provided Jetpack build). Site identifiers available privately on request.

Dominant language
PHP
Stars
1.9k
Forks
913
Avg merge
1d 18h
Merged PRs (30d)
809

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/jetpack

All issues in Automattic/jetpack

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.