Skip to content

Commit 392b342

Browse files
committed
Merge branch '2.3-develop' into ar-pr
2 parents c20cfa4 + 9bb5cd6 commit 392b342

File tree

26 files changed

+587
-211
lines changed

26 files changed

+587
-211
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
use Magento\Catalog\Model\Product\Attribute\Backend\Sku;
1111

1212
/**
13-
* Class Validator
13+
* Product import model validator
1414
*
1515
* @api
1616
* @since 100.0.2
1717
*/
1818
class Validator extends AbstractValidator implements RowValidatorInterface
1919
{
20+
private const ERROR_SKU_MARGINAL_WHITESPACES = "Sku contains marginal whitespaces";
21+
2022
/**
2123
* @var RowValidatorInterface[]|AbstractValidator[]
2224
*/
@@ -72,8 +74,12 @@ protected function textValidation($attrCode, $type)
7274
$val = $this->string->cleanString($this->_rowData[$attrCode]);
7375
if ($type == 'text') {
7476
$valid = $this->string->strlen($val) < Product::DB_MAX_TEXT_LENGTH;
75-
} else if ($attrCode == Product::COL_SKU) {
77+
} elseif ($attrCode == Product::COL_SKU) {
7678
$valid = $this->string->strlen($val) <= SKU::SKU_MAX_LENGTH;
79+
if ($this->string->strlen($val) !== $this->string->strlen(trim($val))) {
80+
$this->_addMessages([self::ERROR_SKU_MARGINAL_WHITESPACES]);
81+
return false;
82+
}
7783
} else {
7884
$valid = $this->string->strlen($val) < Product::DB_MAX_VARCHAR_LENGTH;
7985
}
@@ -359,5 +365,7 @@ public function init($context)
359365
foreach ($this->validators as $validator) {
360366
$validator->init($context);
361367
}
368+
369+
return $this;
362370
}
363371
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,10 @@ private function changePasswordForCustomer($customer, $currentPassword, $newPass
10451045
}
10461046
$customerEmail = $customer->getEmail();
10471047
$this->credentialsValidator->checkPasswordDifferentFromEmail($customerEmail, $newPassword);
1048+
$this->checkPasswordStrength($newPassword);
10481049
$customerSecure = $this->customerRegistry->retrieveSecureData($customer->getId());
10491050
$customerSecure->setRpToken(null);
10501051
$customerSecure->setRpTokenCreatedAt(null);
1051-
$this->checkPasswordStrength($newPassword);
10521052
$customerSecure->setPasswordHash($this->createPasswordHash($newPassword));
10531053
$this->destroyCustomerSessions($customer->getId());
10541054
$this->disableAddressValidation($customer);
@@ -1630,6 +1630,7 @@ private function getEmailNotification()
16301630
*/
16311631
private function destroyCustomerSessions($customerId)
16321632
{
1633+
$this->sessionManager->regenerateId();
16331634
$sessionLifetime = $this->scopeConfig->getValue(
16341635
\Magento\Framework\Session\Config::XML_PATH_COOKIE_LIFETIME,
16351636
\Magento\Store\Model\ScopeInterface::SCOPE_STORE

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,7 @@ public function testChangePassword()
15511551
->with($customer);
15521552

15531553
$this->sessionManager->expects($this->atLeastOnce())->method('getSessionId');
1554+
$this->sessionManager->expects($this->atLeastOnce())->method('regenerateId');
15541555

15551556
$visitor = $this->getMockBuilder(\Magento\Customer\Model\Visitor::class)
15561557
->disableOriginalConstructor()
@@ -1628,6 +1629,7 @@ function ($string) {
16281629

16291630
$this->sessionManager->method('isSessionExists')->willReturn(false);
16301631
$this->sessionManager->expects($this->atLeastOnce())->method('getSessionId');
1632+
$this->sessionManager->expects($this->atLeastOnce())->method('regenerateId');
16311633
$visitor = $this->getMockBuilder(\Magento\Customer\Model\Visitor::class)
16321634
->disableOriginalConstructor()
16331635
->setMethods(['getSessionId'])

app/code/Magento/Eav/Model/Config.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ class Config
157157

158158
/**
159159
* @param \Magento\Framework\App\CacheInterface $cache
160-
* @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory
161-
* @param \Magento\Eav\Model\ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory
160+
* @param Entity\TypeFactory $entityTypeFactory
161+
* @param ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory
162162
* @param \Magento\Framework\App\Cache\StateInterface $cacheState
163163
* @param \Magento\Framework\Validator\UniversalFactory $universalFactory
164-
* @param SerializerInterface $serializer
165-
* @param ScopeConfigInterface $scopeConfig
164+
* @param SerializerInterface|null $serializer
165+
* @param ScopeConfigInterface|null $scopeConfig
166166
* @param array $attributesForPreload
167167
* @codeCoverageIgnore
168168
*/
@@ -374,7 +374,9 @@ protected function _initEntityTypes()
374374
}
375375
\Magento\Framework\Profiler::start('EAV: ' . __METHOD__, ['group' => 'EAV', 'method' => __METHOD__]);
376376

377-
if ($this->isCacheEnabled() && ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))) {
377+
if ($this->isCacheEnabled() &&
378+
($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))
379+
) {
378380
$this->_entityTypeData = $this->serializer->unserialize($cache);
379381
foreach ($this->_entityTypeData as $typeCode => $data) {
380382
$typeId = $data['entity_type_id'];

app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Eav\Model\ResourceModel\Entity\Attribute;
88

9+
/**
10+
* Basic implementation for attribute sets
11+
*/
912
class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1013
{
1114
/**
@@ -24,8 +27,6 @@ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
2427
protected $eavConfig;
2528

2629
/**
27-
* Constructor
28-
*
2930
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
3031
* @param GroupFactory $attrGroupFactory
3132
* @param \Magento\Eav\Model\Config $eavConfig
@@ -54,7 +55,7 @@ protected function _construct()
5455
}
5556

5657
/**
57-
* Perform actions after object save
58+
* Perform actions after object save.
5859
*
5960
* @param \Magento\Framework\Model\AbstractModel $object
6061
* @return $this

app/code/Magento/Eav/etc/di.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,14 @@
209209
</argument>
210210
</arguments>
211211
</type>
212+
<virtualType name="configured_eav_cache" type="Magento\Framework\App\Cache">
213+
<arguments>
214+
<argument name="cacheIdentifier" xsi:type="string">eav</argument>
215+
</arguments>
216+
</virtualType>
217+
<type name="Magento\Eav\Model\Config">
218+
<arguments>
219+
<argument name="cache" xsi:type="object">configured_eav_cache</argument>
220+
</arguments>
221+
</type>
212222
</config>

app/code/Magento/Theme/etc/di.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,24 @@
285285
<argument name="identifierName" xsi:type="string">theme_id</argument>
286286
</arguments>
287287
</type>
288+
<virtualType name="configured_design_cache" type="Magento\Framework\App\Cache">
289+
<arguments>
290+
<argument name="cacheIdentifier" xsi:type="string">layout</argument>
291+
</arguments>
292+
</virtualType>
293+
<virtualType name="design_context" type="Magento\Framework\Model\Context">
294+
<arguments>
295+
<argument name="cacheManager" xsi:type="object">configured_design_cache</argument>
296+
</arguments>
297+
</virtualType>
298+
<type name="Magento\Theme\Model\Design">
299+
<arguments>
300+
<argument name="context" xsi:type="object">design_context</argument>
301+
</arguments>
302+
</type>
303+
<type name="Magento\Theme\Model\Theme\ThemeProvider">
304+
<arguments>
305+
<argument name="cache" xsi:type="object">configured_design_cache</argument>
306+
</arguments>
307+
</type>
288308
</config>

app/etc/di.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,4 +1800,14 @@
18001800
</type>
18011801
<preference for="Magento\Framework\GraphQl\Query\ErrorHandlerInterface" type="Magento\Framework\GraphQl\Query\ErrorHandler"/>
18021802
<preference for="Magento\Framework\Filter\VariableResolverInterface" type="Magento\Framework\Filter\VariableResolver\StrategyResolver"/>
1803+
<virtualType name="configured_block_cache" type="Magento\Framework\App\Cache">
1804+
<arguments>
1805+
<argument name="cacheIdentifier" xsi:type="string">block_html</argument>
1806+
</arguments>
1807+
</virtualType>
1808+
<type name="Magento\Framework\View\Element\Context">
1809+
<arguments>
1810+
<argument name="cache" xsi:type="object">configured_block_cache</argument>
1811+
</arguments>
1812+
</type>
18031813
</config>

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,6 +2416,16 @@ public function validateRowDataProvider()
24162416
'behavior' => Import::BEHAVIOR_REPLACE,
24172417
'expectedResult' => true,
24182418
],
2419+
[
2420+
'row' => ['sku' => 'sku with whitespace ',
2421+
'name' => 'Test',
2422+
'product_type' => 'simple',
2423+
'_attribute_set' => 'Default',
2424+
'price' => 10.20,
2425+
],
2426+
'behavior' => Import::BEHAVIOR_ADD_UPDATE,
2427+
'expectedResult' => false,
2428+
],
24192429
];
24202430
}
24212431

dev/tests/integration/testsuite/Magento/Framework/App/Cache/Frontend/FactoryTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function testRemoteSynchronizedCache()
6363
//Removing data
6464
sleep(2);
6565
$this->assertTrue($this->model->remove($secondIdentifier));
66+
$this->assertTrue($this->model->remove($identifier));
6667
$this->assertEquals($this->model->load($identifier), false);
6768
$this->assertEquals($this->model->load($secondIdentifier), false);
6869

@@ -73,11 +74,5 @@ public function testRemoteSynchronizedCache()
7374
//Checking data
7475
$this->assertEquals($this->model->load($identifier), $data);
7576
$this->assertEquals($this->model->load($secondIdentifier), $secondData);
76-
77-
//Removing data
78-
sleep(2);
79-
$this->assertTrue($this->model->remove($identifier));
80-
$this->assertEquals($this->model->load($identifier), false);
81-
$this->assertEquals($this->model->load($secondIdentifier), false);
8277
}
8378
}

0 commit comments

Comments
 (0)