Skip to content

Commit c1e0382

Browse files
committed
Merge remote-tracking branch 'origin/AC-3110-p3' into delivery-bunch-w21
2 parents 56e7b18 + fa4109d commit c1e0382

File tree

12 files changed

+53
-62
lines changed

12 files changed

+53
-62
lines changed

app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ private function isNeedToPopulateForUrlGeneration($rowData, $newSku, $oldSku): b
302302
(empty($newSku) || !isset($newSku['entity_id']))
303303
|| ($this->import->getRowScope($rowData) == ImportProduct::SCOPE_STORE
304304
&& empty($rowData[self::URL_KEY_ATTRIBUTE_CODE]))
305-
|| (array_key_exists(strtolower($rowData[ImportProduct::COL_SKU]), $oldSku)
305+
|| (array_key_exists(strtolower($rowData[ImportProduct::COL_SKU] ?? ''), $oldSku)
306306
&& !isset($rowData[self::URL_KEY_ATTRIBUTE_CODE])
307307
&& $this->import->getBehavior() === ImportExport::BEHAVIOR_APPEND)
308308
)

app/code/Magento/CatalogUrlRewrite/Observer/CategoryProcessUrlRewriteSavingObserver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Magento\Store\Model\ResourceModel\Group\CollectionFactory;
1818
use Magento\Store\Model\ResourceModel\Group\Collection as StoreGroupCollection;
1919
use Magento\Framework\App\ObjectManager;
20-
use Magento\Store\Model\ScopeInterface;
2120

2221
/**
2322
* Generates Category Url Rewrites after save and Products Url Rewrites assigned to the category that's being saved
@@ -183,7 +182,7 @@ private function setCategoryStoreId($category)
183182

184183
foreach ($storeGroupCollection as $storeGroup) {
185184
/** @var \Magento\Store\Model\Group $storeGroup */
186-
if (in_array($storeGroup->getRootCategoryId(), explode('/', $category->getPath()))) {
185+
if (in_array($storeGroup->getRootCategoryId(), explode('/', $category->getPath() ?? ''))) {
187186
$category->setStoreId($storeGroup->getDefaultStoreId());
188187
}
189188
}

app/code/Magento/CatalogUrlRewrite/Observer/ClearProductUrlsObserver.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator;
1313
use Magento\Framework\Event\ObserverInterface;
1414

15-
/**
16-
* Class ClearProductUrlsObserver
17-
*/
1815
class ClearProductUrlsObserver implements ObserverInterface
1916
{
2017
/**
@@ -43,7 +40,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
4340
$oldSku = $observer->getEvent()->getAdapter()->getOldSku();
4441
$idToDelete = [];
4542
foreach ($products as $product) {
46-
$sku = strtolower($product[ImportProduct::COL_SKU]);
43+
$sku = strtolower($product[ImportProduct::COL_SKU] ?? '');
4744
if (!isset($oldSku[$sku])) {
4845
continue;
4946
}

app/code/Magento/CatalogWidget/Controller/Adminhtml/Product/Widget/Conditions.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,42 @@
55
*/
66
namespace Magento\CatalogWidget\Controller\Adminhtml\Product\Widget;
77

8+
use Magento\Backend\App\Action\Context;
9+
use Magento\CatalogWidget\Model\Rule;
810
use Magento\Rule\Model\Condition\AbstractCondition;
11+
use Magento\CatalogWidget\Controller\Adminhtml\Product\Widget;
912

1013
/**
11-
* Class Conditions
14+
* @SuppressWarnings(PHPMD.AllPurposeAction)
1215
*/
13-
class Conditions extends \Magento\CatalogWidget\Controller\Adminhtml\Product\Widget
16+
class Conditions extends Widget
1417
{
1518
/**
16-
* @var \Magento\CatalogWidget\Model\Rule
19+
* @var Rule
1720
*/
1821
protected $rule;
1922

2023
/**
21-
* @param \Magento\Backend\App\Action\Context $context
22-
* @param \Magento\CatalogWidget\Model\Rule $rule
24+
* @param Context $context
25+
* @param Rule $rule
2326
*/
2427
public function __construct(
25-
\Magento\Backend\App\Action\Context $context,
26-
\Magento\CatalogWidget\Model\Rule $rule
28+
Context $context,
29+
Rule $rule
2730
) {
2831
$this->rule = $rule;
2932
parent::__construct($context);
3033
}
3134

3235
/**
36+
* Product widget conditions action
37+
*
3338
* @return void
3439
*/
3540
public function execute()
3641
{
3742
$id = $this->getRequest()->getParam('id');
38-
$typeData = explode('|', str_replace('-', '/', $this->getRequest()->getParam('type')));
43+
$typeData = explode('|', str_replace('-', '/', $this->getRequest()->getParam('type', '')));
3944
$className = $typeData[0];
4045

4146
$model = $this->_objectManager->create($className)

app/code/Magento/Checkout/Controller/Cart/CouponPost.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ class CouponPost extends \Magento\Checkout\Controller\Cart implements HttpPostAc
2020
protected $quoteRepository;
2121

2222
/**
23-
* Coupon factory
24-
*
2523
* @var \Magento\SalesRule\Model\CouponFactory
2624
*/
2725
protected $couponFactory;
@@ -70,10 +68,10 @@ public function execute()
7068
{
7169
$couponCode = $this->getRequest()->getParam('remove') == 1
7270
? ''
73-
: trim($this->getRequest()->getParam('coupon_code'));
71+
: trim($this->getRequest()->getParam('coupon_code', ''));
7472

7573
$cartQuote = $this->cart->getQuote();
76-
$oldCouponCode = $cartQuote->getCouponCode();
74+
$oldCouponCode = $cartQuote->getCouponCode() ?? '';
7775

7876
$codeLength = strlen($couponCode);
7977
if (!$codeLength && !strlen($oldCouponCode)) {

app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getTreeJson()
6969
$data = [
7070
'text' => $this->_cmsWysiwygImages->getShortFilename($item->getBasename(), 20),
7171
'id' => $this->_cmsWysiwygImages->convertPathToId($item->getFilename()),
72-
'path' => substr($item->getFilename(), strlen($storageRoot)),
72+
'path' => substr($item->getFilename() ?? '', strlen($storageRoot)),
7373
'cls' => 'folder',
7474
];
7575
$hasNestedDirectories = $this->hasNestedDirectories($storageRoot, $item->getFilename());

app/code/Magento/Cms/Block/Page.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,11 @@ class Page extends \Magento\Framework\View\Element\AbstractBlock implements
2727
protected $_page;
2828

2929
/**
30-
* Store manager
31-
*
3230
* @var \Magento\Store\Model\StoreManagerInterface
3331
*/
3432
protected $_storeManager;
3533

3634
/**
37-
* Page factory
38-
*
3935
* @var \Magento\Cms\Model\PageFactory
4036
*/
4137
protected $_pageFactory;
@@ -131,7 +127,7 @@ protected function _addBreadcrumbs(\Magento\Cms\Model\Page $page)
131127
'web/default/cms_home_page',
132128
ScopeInterface::SCOPE_STORE
133129
);
134-
$homePageDelimiterPosition = strrpos($homePageIdentifier, '|');
130+
$homePageDelimiterPosition = $homePageIdentifier === null ? false : strrpos($homePageIdentifier, '|');
135131
if ($homePageDelimiterPosition) {
136132
$homePageIdentifier = substr($homePageIdentifier, 0, $homePageDelimiterPosition);
137133
}

app/code/Magento/Cms/Helper/Page.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ class Page extends AbstractHelper
2626
/**
2727
* CMS no-route config path
2828
*/
29-
const XML_PATH_NO_ROUTE_PAGE = 'web/default/cms_no_route';
29+
public const XML_PATH_NO_ROUTE_PAGE = 'web/default/cms_no_route';
3030

3131
/**
3232
* CMS no cookies config path
3333
*/
34-
const XML_PATH_NO_COOKIES_PAGE = 'web/default/cms_no_cookies';
34+
public const XML_PATH_NO_COOKIES_PAGE = 'web/default/cms_no_cookies';
3535

3636
/**
3737
* CMS home page config path
3838
*/
39-
const XML_PATH_HOME_PAGE = 'web/default/cms_home_page';
39+
public const XML_PATH_HOME_PAGE = 'web/default/cms_home_page';
4040

4141
/**
4242
* Design package instance
@@ -61,15 +61,11 @@ class Page extends AbstractHelper
6161
protected $_localeDate;
6262

6363
/**
64-
* Store manager
65-
*
6664
* @var \Magento\Store\Model\StoreManagerInterface
6765
*/
6866
protected $_storeManager;
6967

7068
/**
71-
* Page factory
72-
*
7369
* @var \Magento\Cms\Model\PageFactory
7470
*/
7571
protected $_pageFactory;
@@ -187,7 +183,9 @@ public function prepareResultPage(ActionInterface $action, $pageId = null)
187183
$resultPage = $this->resultPageFactory->create();
188184
$this->setLayoutType($inRange, $resultPage);
189185
$resultPage->addHandle('cms_page_view');
190-
$pageHandles = ['id' => str_replace('/', '_', $this->_page->getIdentifier())];
186+
$pageHandles = [
187+
'id' => $this->_page->getIdentifier() === null ? '' : str_replace('/', '_', $this->_page->getIdentifier())
188+
];
191189
//Selected custom updates.
192190
try {
193191
$this->customLayoutManager->applyUpdate(

app/code/Magento/Cms/Helper/Wysiwyg/Images.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ class Images extends AbstractHelper
6969
protected $_backendData;
7070

7171
/**
72-
* Store manager
73-
*
7472
* @var StoreManagerInterface
7573
*/
7674
protected $_storeManager;
@@ -173,7 +171,7 @@ public function getTreeNodeName()
173171
*/
174172
public function convertPathToId($path)
175173
{
176-
$path = str_replace($this->getStorageRoot(), '', $path);
174+
$path = $path === null ? '' : str_replace($this->getStorageRoot(), '', $path);
177175
return $this->idEncode($path);
178176
}
179177

@@ -330,7 +328,7 @@ public function getCurrentUrl()
330328
*/
331329
public function idEncode($string)
332330
{
333-
return strtr(base64_encode($string), '+/=', ':_-');
331+
return $string === null ? '' : strtr(base64_encode($string), '+/=', ':_-');
334332
}
335333

336334
/**
@@ -341,7 +339,7 @@ public function idEncode($string)
341339
*/
342340
public function idDecode($string)
343341
{
344-
$string = strtr($string, ':_-', '+/=');
342+
$string = $string === null ? '' : strtr($string, ':_-', '+/=');
345343

346344
// phpcs:ignore Magento2.Functions.DiscouragedFunction
347345
return base64_decode($string);
@@ -356,7 +354,7 @@ public function idDecode($string)
356354
*/
357355
public function getShortFilename($filename, $maxLength = 20)
358356
{
359-
if (strlen($filename) <= $maxLength) {
357+
if (strlen((string)$filename) <= $maxLength) {
360358
return $filename;
361359
}
362360
return substr($filename, 0, $maxLength) . '...';

app/code/Magento/Cms/Model/Page/CustomLayout/CustomLayoutManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function __construct(
8484
*/
8585
private function sanitizeIdentifier(PageInterface $page): string
8686
{
87-
return str_replace('/', '_', $page->getIdentifier());
87+
return $page->getIdentifier() === null ? '' : str_replace('/', '_', $page->getIdentifier());
8888
}
8989

9090
/**

0 commit comments

Comments
 (0)