Skip to content

Commit

Permalink
Merge pull request #98 from matomo-org/php81fixes
Browse files Browse the repository at this point in the history
Couple of fixes for PHP 8.1
  • Loading branch information
tsteur authored Nov 15, 2021
2 parents 1afff79 + 9d48a99 commit 37ad506
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions MatomoTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class MatomoTracker
*/
public function __construct($idSite, $apiUrl = '')
{
$this->ecommerceItems = array();
$this->ecommerceItems = [];
$this->attributionInfo = false;
$this->eventCustomVar = false;
$this->eventCustomVar = [];
$this->forcedDatetime = false;
$this->forcedNewVisit = false;
$this->networkTime = false;
Expand All @@ -93,10 +93,10 @@ public function __construct($idSite, $apiUrl = '')
$this->domProcessingTime = false;
$this->domCompletionTime = false;
$this->onLoadTime = false;
$this->pageCustomVar = false;
$this->ecommerceView = array();
$this->customParameters = array();
$this->customDimensions = array();
$this->pageCustomVar = [];
$this->ecommerceView = [];
$this->customParameters = [];
$this->customDimensions = [];
$this->customData = false;
$this->hasCookies = false;
$this->token_auth = false;
Expand Down Expand Up @@ -153,14 +153,14 @@ public function __construct($idSite, $apiUrl = '')
// Allow debug while blocking the request
$this->requestTimeout = 600;
$this->doBulkRequests = false;
$this->storedTrackingActions = array();
$this->storedTrackingActions = [];

$this->sendImageResponse = true;

$this->visitorCustomVar = $this->getCustomVariablesFromCookie();

$this->outgoingTrackerCookies = array();
$this->incomingTrackerCookies = array();
$this->outgoingTrackerCookies = [];
$this->incomingTrackerCookies = [];
}

/**
Expand Down Expand Up @@ -365,9 +365,9 @@ public function getCustomVariable($id, $scope = 'visit')
*/
public function clearCustomVariables()
{
$this->visitorCustomVar = array();
$this->pageCustomVar = array();
$this->eventCustomVar = array();
$this->visitorCustomVar = [];
$this->pageCustomVar = [];
$this->eventCustomVar = [];
}

/**
Expand Down Expand Up @@ -2105,13 +2105,13 @@ protected function setCookie($cookieName, $cookieValue, $cookieTTL)
}

/**
* @return bool|mixed
* @return array
*/
protected function getCustomVariablesFromCookie()
{
$cookie = $this->getCookieMatchingName('cvar');
if (!$cookie) {
return false;
return [];
}

return json_decode($cookie, $assoc = true);
Expand Down

0 comments on commit 37ad506

Please sign in to comment.