Skip to content

Commit 9bc23cc

Browse files
committed
ACP2E-4191: [B2B] Webapi requests go infinite loop for logged-in customers when 'eav' cache disabled
1 parent 1d11147 commit 9bc23cc

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,11 @@ class Session extends \Magento\Framework\Session\SessionManager
108108
private $accountConfirmation;
109109

110110
/**
111-
* Session constructor.
112-
*
111+
* @var CustomerRegistry
112+
*/
113+
private $customerRegistry;
114+
115+
/**
113116
* @param \Magento\Framework\App\Request\Http $request
114117
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
115118
* @param \Magento\Framework\Session\Config\ConfigInterface $sessionConfig
@@ -132,6 +135,7 @@ class Session extends \Magento\Framework\Session\SessionManager
132135
* @param GroupManagementInterface $groupManagement
133136
* @param \Magento\Framework\App\Response\Http $response
134137
* @param AccountConfirmation $accountConfirmation
138+
* @param CustomerRegistry|null $customerRegistry
135139
* @throws \Magento\Framework\Exception\SessionException
136140
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
137141
*/
@@ -157,7 +161,8 @@ public function __construct(
157161
CustomerRepositoryInterface $customerRepository,
158162
GroupManagementInterface $groupManagement,
159163
\Magento\Framework\App\Response\Http $response,
160-
?AccountConfirmation $accountConfirmation = null
164+
?AccountConfirmation $accountConfirmation = null,
165+
?CustomerRegistry $customerRegistry = null,
161166
) {
162167
$this->_coreUrl = $coreUrl;
163168
$this->_customerUrl = $customerUrl;
@@ -173,6 +178,9 @@ public function __construct(
173178
$this->response = $response;
174179
$this->accountConfirmation = $accountConfirmation ?: ObjectManager::getInstance()
175180
->get(AccountConfirmation::class);
181+
$this->customerRegistry = $customerRegistry ?: ObjectManager::getInstance()
182+
->get(CustomerRegistry::class);
183+
176184
parent::__construct(
177185
$request,
178186
$sidResolver,
@@ -429,7 +437,7 @@ public function checkCustomerId($customerId)
429437
}
430438

431439
try {
432-
$this->customerRepository->getById($customerId);
440+
$this->customerRegistry->retrieve($customerId);
433441
$this->_isCustomerIdChecked = $customerId;
434442
return true;
435443
} catch (\Exception $e) {

0 commit comments

Comments
 (0)