From 27dc1b67c5bf4e19802205deb50b607784a67054 Mon Sep 17 00:00:00 2001 From: magdev Date: Thu, 22 Jan 2026 00:06:28 +0100 Subject: [PATCH] Fix AnalyticsController being garbage collected Store the AnalyticsController instance as a class property to prevent it from being garbage collected before WordPress can call the registered callbacks. Co-Authored-By: Claude Opus 4.5 --- src/Plugin.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Plugin.php b/src/Plugin.php index 0bd2459..2f04515 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -57,6 +57,11 @@ final class Plugin */ private DownloadController $downloadController; + /** + * Analytics controller + */ + private ?AnalyticsController $analyticsController = null; + /** * Get singleton instance */ @@ -134,7 +139,8 @@ final class Plugin new VersionAdminController($this->versionManager); new OrderLicenseController($this->licenseManager); new SettingsController(); - (new AnalyticsController($this->licenseManager))->init(); + $this->analyticsController = new AnalyticsController($this->licenseManager); + $this->analyticsController->init(); } }