Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-06-05 06:28:35 +0400
committermattab <matthieu.aubry@gmail.com>2014-06-05 06:28:35 +0400
commitdbd8960264605dae20b535110f8d541057922c1e (patch)
treed448300c726f60179b9547bfc0bae862ac566bb7 /libs
parent7ddbf0e7bf12792a59ac0fe3eca248e606a33e0f (diff)
Fixes #5291 Reset the object properties, when issuing a bulk request
to avoid leaking values from one visitor request to the next (who could be completely different visitor)
Diffstat (limited to 'libs')
-rw-r--r--libs/PiwikTracker/PiwikTracker.php68
1 files changed, 42 insertions, 26 deletions
diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php
index 95c10bf676..93fad0bde4 100644
--- a/libs/PiwikTracker/PiwikTracker.php
+++ b/libs/PiwikTracker/PiwikTracker.php
@@ -160,22 +160,9 @@ class PiwikTracker
*/
function __construct($idSite, $apiUrl = '')
{
- $this->userAgent = false;
- $this->localHour = false;
- $this->localMinute = false;
- $this->localSecond = false;
- $this->hasCookies = false;
- $this->plugins = false;
- $this->pageCustomVar = false;
- $this->eventCustomVar = false;
- $this->customData = false;
- $this->forcedDatetime = false;
- $this->forcedNewVisit = false;
$this->token_auth = false;
- $this->attributionInfo = false;
- $this->ecommerceLastOrderTimestamp = false;
- $this->ecommerceItems = array();
- $this->generationTime = false;
+
+ $this->init();
$this->idSite = $idSite;
$this->urlReferrer = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false;
@@ -195,23 +182,12 @@ class PiwikTracker
// Life of the session cookie (in sec)
$this->configReferralCookieTimeout = 15768000; // 6 months
- // Visitor Ids in order
- $this->forcedVisitorId = false;
- $this->cookieVisitorId = false;
- $this->randomVisitorId = false;
-
$this->setNewVisitorId();
$this->configCookiesDisabled = false;
$this->configCookiePath = self::DEFAULT_COOKIE_PATH;
$this->configCookieDomain = '';
- $this->currentTs = time();
- $this->createTs = $this->currentTs;
- $this->visitCount = 0;
- $this->currentVisitTs = false;
- $this->lastVisitTs = false;
- $this->lastEcommerceOrderTs = false;
// Allow debug while blocking the request
$this->requestTimeout = 600;
@@ -1182,6 +1158,11 @@ class PiwikTracker
= $url
. (!empty($this->userAgent) ? ('&ua=' . urlencode($this->userAgent)) : '')
. (!empty($this->acceptLanguage) ? ('&lang=' . urlencode($this->acceptLanguage)) : '');
+
+ // if we run in bulk tracking mode, the next tracking request
+ // may be from a completely different visitor, so we clean up properties
+ $this->init();
+
return true;
}
@@ -1527,6 +1508,41 @@ class PiwikTracker
}
return json_decode($cookie, $assoc = true);
}
+
+ /**
+ * Initializes properties
+ */
+ protected function init()
+ {
+ $this->userAgent = false;
+ $this->localHour = false;
+ $this->localMinute = false;
+ $this->localSecond = false;
+ $this->hasCookies = false;
+ $this->plugins = false;
+ $this->pageCustomVar = false;
+ $this->eventCustomVar = false;
+ $this->customData = false;
+ $this->forcedDatetime = false;
+ $this->forcedNewVisit = false;
+ $this->attributionInfo = false;
+ $this->ecommerceLastOrderTimestamp = false;
+ $this->ecommerceItems = array();
+ $this->generationTime = false;
+
+ // Visitor Ids in order
+ $this->forcedVisitorId = false;
+ $this->cookieVisitorId = false;
+ $this->randomVisitorId = false;
+
+ // Times
+ $this->currentTs = time();
+ $this->createTs = $this->currentTs;
+ $this->visitCount = 0;
+ $this->currentVisitTs = false;
+ $this->lastVisitTs = false;
+ $this->lastEcommerceOrderTs = false;
+ }
}
/**