Skip to content

Commit f8620b9

Browse files
authored
Merge pull request #4683 from magento-performance/MC-19612
MC-19612
2 parents fd0c3d0 + 2c82905 commit f8620b9

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

app/code/Magento/Customer/Model/Visitor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ public function initByRequest($observer)
169169

170170
$this->setLastVisitAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT));
171171

172+
// prevent saving Visitor for safe methods, e.g. GET request
173+
if ($this->requestSafety->isSafeMethod()) {
174+
return $this;
175+
}
176+
172177
if (!$this->getId()) {
173178
$this->setSessionId($this->session->getSessionId());
174179
$this->save();

dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -798,21 +798,6 @@ public function loginPostRedirectDataProvider()
798798
];
799799
}
800800

801-
/**
802-
* @magentoDataFixture Magento/Customer/_files/customer.php
803-
* @magentoDataFixture Magento/Customer/_files/customer_address.php
804-
* @magentoAppArea frontend
805-
*/
806-
public function testCheckVisitorModel()
807-
{
808-
/** @var \Magento\Customer\Model\Visitor $visitor */
809-
$visitor = $this->_objectManager->get(\Magento\Customer\Model\Visitor::class);
810-
$this->login(1);
811-
$this->assertNull($visitor->getId());
812-
$this->dispatch('customer/account/index');
813-
$this->assertNotNull($visitor->getId());
814-
}
815-
816801
/**
817802
* @param string $email
818803
* @return void

0 commit comments

Comments
 (0)