Skip to content

Commit 395432d

Browse files
committed
Merge remote-tracking branch 'origin/AC-3162-p9' into delivery-bunch-w22
2 parents b352230 + 01b390a commit 395432d

File tree

12 files changed

+38
-41
lines changed

12 files changed

+38
-41
lines changed

app/code/Magento/UrlRewrite/Controller/Router.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public function match(RequestInterface $request)
9696
return null;
9797
}
9898

99-
$requestStringTrimmed = ltrim($request->getRequestString(), '/');
99+
$requestStringTrimmed = ltrim($request->getRequestString() ?? '', '/');
100100
$rewriteRequestPath = $rewrite->getRequestPath();
101-
$rewriteTargetPath = $rewrite->getTargetPath();
101+
$rewriteTargetPath = $rewrite->getTargetPath() ?? '';
102102
$rewriteTargetPathTrimmed = ltrim($rewriteTargetPath, '/');
103103

104104
if (preg_replace('/\?.*/', '', $rewriteRequestPath) === preg_replace('/\?.*/', '', $rewriteTargetPath) &&
@@ -141,7 +141,7 @@ protected function processRedirect($request, $rewrite)
141141
{
142142
$target = $rewrite->getTargetPath();
143143
if ($rewrite->getEntityType() !== Rewrite::ENTITY_TYPE_CUSTOM
144-
|| ($prefix = substr($target, 0, 6)) !== 'http:/' && $prefix !== 'https:'
144+
|| ($prefix = substr((string)$target, 0, 6)) !== 'http:/' && $prefix !== 'https:'
145145
) {
146146
$target = $this->url->getUrl('', ['_direct' => $target, '_query' => $request->getParams()]);
147147
}

app/code/Magento/UrlRewrite/Helper/UrlRewrite.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class UrlRewrite extends \Magento\Framework\App\Helper\AbstractHelper
1414
/**
1515
* Validation error constants
1616
*/
17-
const VERR_MANYSLASHES = 1;
17+
public const VERR_MANYSLASHES = 1;
1818

1919
// Too many slashes in a row of request path, e.g. '///foo//'
20-
const VERR_ANCHOR = 2;
20+
public const VERR_ANCHOR = 2;
2121

2222
// Anchor is not supported in request path, e.g. 'foo#bar'
2323

@@ -47,6 +47,7 @@ public function __construct(
4747
*/
4848
protected function _validateRequestPath($requestPath)
4949
{
50+
$requestPath = $requestPath !== null ? $requestPath : '';
5051
if (strpos($requestPath, '//') !== false) {
5152
throw new \Exception(
5253
__('Do not use two or more consecutive slashes in the request path.'),

app/code/Magento/UrlRewrite/Model/Storage/DbStorage.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ class DbStorage extends AbstractStorage
2626
/**
2727
* DB Storage table name
2828
*/
29-
const TABLE_NAME = 'url_rewrite';
29+
public const TABLE_NAME = 'url_rewrite';
3030

3131
/**
3232
* Code of "Integrity constraint violation: 1062 Duplicate entry" error
3333
*/
34-
const ERROR_CODE_DUPLICATE_ENTRY = 1062;
34+
public const ERROR_CODE_DUPLICATE_ENTRY = 1062;
3535

3636
/**
3737
* @var AdapterInterface
@@ -139,9 +139,10 @@ private function extractMostRelevantUrlRewrite(string $requestPath, array $urlRe
139139
$prioritizedUrlRewrites = [];
140140
foreach ($urlRewrites as $urlRewrite) {
141141
$urlRewriteRequestPath = $urlRewrite[UrlRewrite::REQUEST_PATH];
142-
$urlRewriteTargetPath = $urlRewrite[UrlRewrite::TARGET_PATH];
142+
$urlRewriteTargetPath = $urlRewrite[UrlRewrite::TARGET_PATH] ?? '';
143+
$trimmedUrlRewriteRequestPath = rtrim($urlRewriteRequestPath ?? '', '/');
143144
switch (true) {
144-
case rtrim($urlRewriteRequestPath, '/') === rtrim($urlRewriteTargetPath, '/'):
145+
case $trimmedUrlRewriteRequestPath === rtrim($urlRewriteTargetPath, '/'):
145146
$priority = 99;
146147
break;
147148
case $urlRewriteRequestPath === $requestPath:
@@ -150,10 +151,10 @@ private function extractMostRelevantUrlRewrite(string $requestPath, array $urlRe
150151
case $urlRewriteRequestPath === urldecode($requestPath):
151152
$priority = 2;
152153
break;
153-
case rtrim($urlRewriteRequestPath, '/') === rtrim($requestPath, '/'):
154+
case $trimmedUrlRewriteRequestPath === rtrim($requestPath, '/'):
154155
$priority = 3;
155156
break;
156-
case rtrim($urlRewriteRequestPath, '/') === rtrim(urldecode($requestPath), '/'):
157+
case $trimmedUrlRewriteRequestPath === rtrim(urldecode($requestPath), '/'):
157158
$priority = 4;
158159
break;
159160
default:

app/code/Magento/User/Setup/Patch/Data/UpgradePasswordHashes.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@
66

77
namespace Magento\User\Setup\Patch\Data;
88

9+
use Magento\Framework\Console\Cli;
910
use Magento\Framework\Encryption\Encryptor;
10-
use Magento\Framework\App\ResourceConnection;
1111
use Magento\Framework\Setup\Patch\DataPatchInterface;
1212
use Magento\Framework\Setup\Patch\PatchVersionInterface;
1313

14-
/**
15-
* Class UpgradePasswordHashes
16-
* @package Magento\User\Setup\Patch
17-
*/
1814
class UpgradePasswordHashes implements DataPatchInterface, PatchVersionInterface
1915
{
2016
/**
@@ -33,33 +29,35 @@ public function __construct(
3329
}
3430

3531
/**
36-
* {@inheritdoc}
32+
* @inheritdoc
3733
*/
3834
public function apply()
3935
{
4036
$this->moduleDataSetup->getConnection()->startSetup();
4137
$this->upgradeHash();
4238
$this->moduleDataSetup->getConnection()->endSetup();
39+
40+
return Cli::RETURN_SUCCESS;
4341
}
4442

4543
/**
46-
* {@inheritdoc}
44+
* @inheritdoc
4745
*/
4846
public static function getDependencies()
4947
{
5048
return [];
5149
}
5250

5351
/**
54-
* {@inheritdoc}
52+
* @inheritdoc
5553
*/
5654
public static function getVersion()
5755
{
5856
return '2.0.1';
5957
}
6058

6159
/**
62-
* {@inheritdoc}
60+
* @inheritdoc
6361
*/
6462
public function getAliases()
6563
{
@@ -81,7 +79,7 @@ private function upgradeHash()
8179

8280
$customers = $connection->fetchAll($select);
8381
foreach ($customers as $customer) {
84-
list($hash, $salt) = explode(Encryptor::DELIMITER, $customer['password']);
82+
list($hash, $salt) = explode(Encryptor::DELIMITER, $customer['password'] ?? '');
8583

8684
$newHash = $customer['password'];
8785
if (strlen($hash) === 32) {

app/code/Magento/Usps/Model/Carrier.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ function () use ($deferredResponse, $request, $debugData) {
643643
protected function _parseXmlResponse($response)
644644
{
645645
$r = $this->_rawRequest;
646-
$allowedMethods = explode(',', $this->getConfigData('allowed_methods'));
646+
$allowedMethods = explode(',', $this->getConfigData('allowed_methods') ?? '');
647647
$serviceCodeToActualNameMap = [];
648648
$isUS = $this->_isUSCountry($r->getDestCountryId());
649649
$costArr = [];
@@ -1235,7 +1235,7 @@ public function getResponse()
12351235
*/
12361236
public function getAllowedMethods()
12371237
{
1238-
$allowed = explode(',', $this->getConfigData('allowed_methods'));
1238+
$allowed = explode(',', $this->getConfigData('allowed_methods') ?? '');
12391239
$arr = [];
12401240
foreach ($allowed as $k) {
12411241
$arr[$k] = $this->getCode('method', $k);
@@ -2135,14 +2135,14 @@ protected function _parseZip($zipString, $returnFull = false)
21352135
$zip4 = '';
21362136
$zip5 = '';
21372137
$zip = [$zipString];
2138-
if (preg_match('/[\\d\\w]{5}\\-[\\d\\w]{4}/', $zipString) != 0) {
2138+
if ($zipString !== null && preg_match('/[\\d\\w]{5}\\-[\\d\\w]{4}/', $zipString) != 0) {
21392139
$zip = explode('-', $zipString);
21402140
}
21412141
$count = count($zip);
21422142
for ($i = 0; $i < $count; ++$i) {
2143-
if (strlen($zip[$i]) == 5) {
2143+
if (strlen($zip[$i] ?? '') == 5) {
21442144
$zip5 = $zip[$i];
2145-
} elseif (strlen($zip[$i]) == 4) {
2145+
} elseif (strlen($zip[$i] ?? '') == 4) {
21462146
$zip4 = $zip[$i];
21472147
}
21482148
}

app/code/Magento/Variable/Ui/Component/VariablesDataProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ public function getData()
122122

123123
foreach ($searchCriteria->getFilterGroups() as $filterGroup) {
124124
foreach ($filterGroup->getFilters() as $filter) {
125-
$value = str_replace('%', '', $filter->getValue());
125+
$value = str_replace('%', '', $filter->getValue() ?? '');
126126
$filterField = $filter->getField();
127127
$items = array_values(
128128
array_filter(
129129
$items,
130130
function ($item) use ($value, $filterField) {
131-
return strpos(strtolower($item[$filterField]), (string) strtolower($value)) !== false;
131+
return strpos(strtolower($item[$filterField] ?? ''), strtolower((string)$value)) !== false;
132132
}
133133
)
134134
);

app/code/Magento/Vault/Plugin/PaymentVaultInformationManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function beforeSavePaymentInformation(
6060
): void {
6161
$availableMethods = $this->vaultPaymentMethodList->getActiveList($this->storeManager->getStore()->getId());
6262
foreach ($availableMethods as $availableMethod) {
63-
if (strpos($paymentMethod->getMethod(), $availableMethod->getCode()) !== false) {
63+
if (strpos($paymentMethod->getMethod() ?? '', $availableMethod->getCode()) !== false) {
6464
$paymentMethod->setMethod($availableMethod->getCode());
6565
}
6666
}

app/code/Magento/Version/Controller/Index/Index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class Index extends Action implements HttpGetActionInterface
2020
{
21-
const DEV_PREFIX = 'dev-';
21+
public const DEV_PREFIX = 'dev-';
2222

2323
/**
2424
* @var ProductMetadataInterface
@@ -52,7 +52,7 @@ public function execute()
5252
{
5353
$rawResponse = $this->rawFactory->create();
5454

55-
$version = $this->productMetadata->getVersion();
55+
$version = $this->productMetadata->getVersion() ?? '';
5656
$versionParts = explode('.', $version);
5757
if (!$this->isGitBasedInstallation($version) && $this->isCorrectVersion($versionParts)) {
5858
$rawResponse->setContents(

app/code/Magento/Webapi/Controller/PathProcessor.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@
99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Framework\Exception\NoSuchEntityException;
1111

12-
/**
13-
* Class PathProcessor
14-
*/
1512
class PathProcessor
1613
{
1714
/** Store code alias to indicate that all stores should be affected by action */
18-
const ALL_STORE_CODE = 'all';
15+
public const ALL_STORE_CODE = 'all';
1916

2017
/**
2118
* @var \Magento\Store\Model\StoreManagerInterface
@@ -49,7 +46,7 @@ public function __construct(
4946
*/
5047
private function stripPathBeforeStorecode($pathInfo)
5148
{
52-
$pathParts = explode('/', trim($pathInfo, '/'));
49+
$pathParts = explode('/', $pathInfo !== null ? trim($pathInfo, '/') : '');
5350
array_shift($pathParts);
5451
$path = '/' . implode('/', $pathParts);
5552
return explode('/', ltrim($path, '/'), 2);

app/code/Magento/Webapi/Controller/Rest/InputParamsResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private function validateParameters(
175175
): void {
176176
$methodParams = $this->methodsMap->getMethodParams($serviceClassName, $serviceMethodName);
177177
foreach ($paramOverriders as $key => $param) {
178-
$arrayKeys = explode('.', $param);
178+
$arrayKeys = explode('.', $param ?? '');
179179
$value = array_shift($arrayKeys);
180180

181181
foreach ($methodParams as $serviceMethodParam) {

0 commit comments

Comments
 (0)