Skip to content

Commit 6e83313

Browse files
committed
Merge remote-tracking branch 'origin/AC-3110-p6' into delivery-bunch-w21
2 parents 008aaf0 + 9b4fb44 commit 6e83313

File tree

12 files changed

+35
-25
lines changed

12 files changed

+35
-25
lines changed

app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ public function getAllowedChars()
3939
*/
4040
public function getNextId()
4141
{
42-
$lastId = $this->getLastId();
42+
$lastId = (string)$this->getLastId();
43+
$prefix = (string)$this->getPrefix();
4344

44-
if (strpos($lastId, (string) $this->getPrefix()) === 0) {
45-
$lastId = substr($lastId, strlen($this->getPrefix()));
45+
if (strpos($lastId, $prefix) === 0) {
46+
$lastId = substr($lastId, strlen($prefix));
4647
}
4748

48-
$lastId = str_pad((string)$lastId, $this->getPadLength(), $this->getPadChar(), STR_PAD_LEFT);
49+
$lastId = str_pad($lastId, $this->getPadLength(), $this->getPadChar(), STR_PAD_LEFT);
4950

5051
$nextId = '';
5152
$bumpNextChar = true;

app/code/Magento/Eav/Model/Entity/Increment/NumericValue.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ class NumericValue extends \Magento\Eav\Model\Entity\Increment\AbstractIncrement
2727
public function getNextId()
2828
{
2929
$last = $this->getLastId();
30+
$prefix = (string)$this->getPrefix();
3031

31-
if (is_string($last) && '' !== $last && strpos($last, (string) $this->getPrefix()) === 0) {
32-
$last = (int)substr($last, strlen($this->getPrefix()));
32+
if (is_string($last) && '' !== $last && strpos($last, $prefix) === 0) {
33+
$last = (int)substr($last, strlen($prefix));
3334
} else {
3435
$last = (int)$last;
3536
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ protected function _saveStoreLabels(AbstractModel $object)
282282
$connection->delete($this->getTable('eav_attribute_label'), $condition);
283283
}
284284
foreach ($storeLabels as $storeId => $label) {
285-
if ($storeId == 0 || !strlen($label)) {
285+
if ($storeId == 0 || $label === null || !strlen($label)) {
286286
continue;
287287
}
288288
$bind = ['attribute_id' => $object->getId(), 'store_id' => $storeId, 'value' => $label];

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1414
/**
1515
* EAV cache id
1616
*/
17-
const ATTRIBUTES_CACHE_ID = 'EAV_ENTITY_ATTRIBUTES_BY_SET_ID';
17+
public const ATTRIBUTES_CACHE_ID = 'EAV_ENTITY_ATTRIBUTES_BY_SET_ID';
1818

1919
/**
2020
* @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\GroupFactory
@@ -121,7 +121,10 @@ protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
121121
public function validate($object, $attributeSetName)
122122
{
123123
$connection = $this->getConnection();
124-
$bind = ['attribute_set_name' => trim($attributeSetName), 'entity_type_id' => $object->getEntityTypeId()];
124+
$bind = [
125+
'attribute_set_name' => $attributeSetName === null ? '' : trim($attributeSetName),
126+
'entity_type_id' => $object->getEntityTypeId()
127+
];
125128
$select = $connection->select()->from(
126129
$this->getMainTable()
127130
)->where(

app/code/Magento/Eav/Model/Validator/Attribute/Code.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
1111
use Magento\Eav\Model\Entity\Attribute;
12-
use Magento\Framework\Exception\LocalizedException;
1312
use Magento\Framework\Validator\AbstractValidator;
1413
use Zend_Validate;
1514

@@ -23,7 +22,7 @@ class Code extends AbstractValidator
2322
/**
2423
* Validation pattern for attribute code
2524
*/
26-
const VALIDATION_RULE_PATTERN = '/^[a-zA-Z]+[a-zA-Z0-9_]*$/u';
25+
public const VALIDATION_RULE_PATTERN = '/^[a-zA-Z]+[a-zA-Z0-9_]*$/u';
2726

2827
/**
2928
* Validates the correctness of the attribute code
@@ -38,6 +37,7 @@ public function isValid($attributeCode): bool
3837
/**
3938
* Check attribute_code for allowed characters
4039
*/
40+
$attributeCode = $attributeCode === null ? '' : $attributeCode;
4141
if (trim($attributeCode)
4242
&& !preg_match(self::VALIDATION_RULE_PATTERN, trim($attributeCode))
4343
) {

app/code/Magento/Eav/Setup/EavSetup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public function addAttributeGroup($entityTypeId, $setId, $name, $sortOrder = nul
612612
*/
613613
public function convertToAttributeGroupCode($groupName)
614614
{
615-
return trim(preg_replace('/[^a-z0-9]+/', '-', strtolower($groupName)), '-');
615+
return trim(preg_replace('/[^a-z0-9]+/', '-', strtolower((string)$groupName)), '-');
616616
}
617617

618618
/**

app/code/Magento/Elasticsearch/Model/Config/Backend/MinimumShouldMatch.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ public function beforeSave()
3232
*/
3333
public function validateValue(): void
3434
{
35-
if (strlen($this->getValue()) && !preg_match('/^((\d+<)?-?\d+%?\s?)+$/', $this->getValue())) {
35+
if ($this->getValue() !== null
36+
&& strlen($this->getValue())
37+
&& !preg_match('/^((\d+<)?-?\d+%?\s?)+$/', $this->getValue())
38+
) {
3639
throw new LocalizedException(
3740
__(
3841
'Value for the field "%1" was not saved because of the incorrect format.',

app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder/Sort.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function getSort(RequestInterface $request)
117117
}
118118
$sorts[] = [
119119
$fieldName => [
120-
'order' => strtolower($item['direction'])
120+
'order' => strtolower($item['direction'] ?? '')
121121
]
122122
];
123123
}

app/code/Magento/Email/Block/Adminhtml/Template/Edit.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function __construct(
104104
}
105105

106106
/**
107-
* {@inheritdoc}
107+
* @inheritdoc
108108
*/
109109
public function updateButton($buttonId, $key, $data)
110110
{
@@ -113,15 +113,15 @@ public function updateButton($buttonId, $key, $data)
113113
}
114114

115115
/**
116-
* {@inheritdoc}
116+
* @inheritdoc
117117
*/
118118
public function canRender(\Magento\Backend\Block\Widget\Button\Item $item)
119119
{
120120
return !$item->isDeleted();
121121
}
122122

123123
/**
124-
* {@inheritdoc}
124+
* @inheritdoc
125125
*/
126126
public function removeButton($buttonId)
127127
{
@@ -230,7 +230,7 @@ protected function _prepareLayout()
230230
}
231231

232232
/**
233-
* {@inheritdoc}
233+
* @inheritdoc
234234
*/
235235
public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
236236
{
@@ -413,7 +413,7 @@ public function getCurrentlyUsedForPaths($asJSON = true)
413413
* @return array
414414
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
415415
*/
416-
protected function _getSystemConfigPathsParts($paths)
416+
protected function _getSystemConfigPathsParts($paths) // phpcs:ignore Generic.Metrics.NestingLevel
417417
{
418418
$result = $urlParams = $prefixParts = [];
419419
$scopeLabel = __('Default Config');
@@ -431,7 +431,7 @@ protected function _getSystemConfigPathsParts($paths)
431431

432432
$pathParts = $prefixParts;
433433
foreach ($paths as $pathData) {
434-
$pathDataParts = explode('/', $pathData['path']);
434+
$pathDataParts = explode('/', $pathData['path'] ?? '');
435435
$sectionName = array_shift($pathDataParts);
436436

437437
$urlParams = ['section' => $sectionName];

app/code/Magento/Email/Console/Command/DatabaseTemplateCompatibilityCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected function checkTemplate(AbstractTemplate $template, OutputInterface $ou
116116
private function renderErrors(OutputInterface $output, array $errors): void
117117
{
118118
foreach ($errors as $error) {
119-
$error = str_replace(PHP_EOL, PHP_EOL . ' ', $error);
119+
$error = str_replace(PHP_EOL, PHP_EOL . ' ', $error ?? '');
120120
$output->writeln(
121121
'<error> - ' . $error . '</error>'
122122
);

0 commit comments

Comments
 (0)