Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Updates to prevent unnecessary duplicate sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
ppamment committed Nov 14, 2017
1 parent a682669 commit d88bafa
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions EventListener/VisitorTrackingSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ public function onKernelResponse(FilterResponseEvent $event)
$request = $event->getRequest();
$response = $event->getResponse();

if ($this->requestHasUTMParameters($request)) {
$this->setUTMSessionCookies($request, $response);
}

if (!$request->cookies->has(self::COOKIE_LIFETIME)) {
$response->headers->setCookie(new Cookie(self::COOKIE_LIFETIME, $this->lifetime->getId(), new \DateTime("+2 years"), "/", null, false, false));
}
Expand Down Expand Up @@ -141,7 +137,7 @@ private function sessionMatchesRequestParameters(Request $request)
{
foreach ($this->utmCodes as $code) {
$method = 'get'.Inflector::classify($code);
if ($request->query->get($code) != $this->session->$method()) {
if ($request->query->get($code, '') !== $this->session->$method()) {
return false;
}
}
Expand Down

0 comments on commit d88bafa

Please sign in to comment.