Make "WooCommerce Analytics" ready for PHP 8.3 #22838
Labels
Enhancement
For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
triaged
Customer is using "WooCommerce Analytics"-Plugin for their eCommerce systems. They have now upgraded their infrastructure to PHP 8.3. After upgrading the PHP version, they received a couple of "PHP Deprecated: Creation of dynamic property" warnings about uninitiated variables
Most of the "Warnings" are located in the "Tracker.php"-File. Here are two examples..
[03-Dec-2024 13:14:35 UTC] PHP Deprecated: Creation of dynamic property WooPiwik\Tracking\Tracker::$configSessionCookieTimeout is deprecated in /var/www/html/wp-content/plugins/woocommerce-piwik-analytics/libs/piwik-php-tracker/MatomoTracker.php on line 187
[03-Dec-2024 13:14:35 UTC] PHP Deprecated: Creation of dynamic property WooPiwik\Tracking\Tracker::$configReferralCookieTimeout is deprecated in /var/www/html/wp-content/plugins/woocommerce-piwik-analytics/libs/piwik-php-tracker/MatomoTracker.php on line 189
Customer informed us that the solution to remove the warnings is, to add the definition to the top of the class
private null|string $requestMethod = null;
public false|null|array $ecommerceItems;
public false|null|array $attributionInfo;
public false|null|array $eventCustomVar;
public mixed $forcedDatetime;
public null|bool $forcedNewVisit;
public false|int|null $networkTime;
public false|null|int $serverTime;
public false|null|int $transferTime;
public false|null|int $domProcessingTime;
public false|null|int $domCompletionTime;
public false|null|int $onLoadTime;
public false|null|array $pageCustomVar;
public false|null|array $ecommerceView;
public false|null|array $customParameters;
public false|null|array $customDimensions;
public mixed $customData;
public null|bool $hasCookies;
public mixed $token_auth;
public false|null|string $userAgent;
public false|null|string $country;
public false|null|string $region;
public false|null|string $city;
public false|null|float $lat;
public false|null|float $long;
public false|null|int $width;
public false|null|int $height;
public false|null|string $plugins;
public false|null|int $localHour;
public mixed $localMinute;
public mixed $localSecond;
public mixed $idPageview;
public mixed $idSite;
public mixed $urlReferrer;
public mixed $pageCharset;
public mixed $pageUrl;
public mixed $ip;
public false|string $acceptLanguage;
public int $configVisitorCookieTimeout = 0;
public int $configSessionCookieTimeout = 0;
public int $configReferralCookieTimeout = 0;
public false|string|int $userId;
public false|string $forcedVisitorId;
public mixed $cookieVisitorId;
public mixed $randomVisitorId;
public bool $configCookiesDisabled;
public null|string $configCookiePath;
public null|string $configCookieDomain;
public null|int $currentTs;
public mixed $createTs;
public null|int $requestTimeout;
public bool $doBulkRequests;
public false|null|array $storedTrackingActions;
public bool $sendImageResponse;
public false|null|array $visitorCustomVar;
public false|null|array $outgoingTrackerCookies;
public false|null|array $incomingTrackerCookies;
This fixes the "PHP Deprecated: Creation of dynamic property" warning
The text was updated successfully, but these errors were encountered: