Skip to content

Commit 4f3979b

Browse files
committed
Magento 8.1 fixes
1 parent 2bc0f35 commit 4f3979b

File tree

11 files changed

+16
-17
lines changed

11 files changed

+16
-17
lines changed

app/code/Magento/Backend/App/DefaultPath.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class DefaultPath implements \Magento\Framework\App\DefaultPathInterface
2424
*/
2525
public function __construct(\Magento\Backend\App\ConfigInterface $config)
2626
{
27-
$pathParts = explode('/', $config->getValue('web/default/admin'));
27+
$path = $config->getValue('web/default/admin');
28+
$pathParts = $path ? explode('/', $path) : [''];
2829

2930
$this->_parts = [
3031
'area' => isset($pathParts[0]) ? $pathParts[0] : '',

app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use Magento\Framework\View\Helper\SecureHtmlRenderer;
1919
<?php foreach ($tabs as $_tab): ?>
2020
<?php $tabId = $block->getTabId($_tab) ?>
2121
<?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' .
22-
(preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?>
22+
(preg_match('/\s?ajax\s?/', $_tab->getClass() ?? '') ? 'notloaded' : '') ?>
2323
<?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?>
2424
<?php $_tabHref = $block->getTabUrl($_tab) == '#' ?
2525
'#' . $tabId . '_content' :

app/code/Magento/Eav/Model/Entity/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public function getValueTablePrefix()
303303
*/
304304
public function getEntityTablePrefix()
305305
{
306-
$tablePrefix = trim($this->_data['value_table_prefix']);
306+
$tablePrefix = trim((string) $this->_data['value_table_prefix']);
307307

308308
if (empty($tablePrefix)) {
309309
$tablePrefix = $this->getEntityTable();

app/code/Magento/Security/Observer/AdminUserAuthenticateBefore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function execute(Observer $observer)
5656
/** @var \Magento\User\Model\User $user */
5757
$user->loadByUsername($username);
5858

59-
if ($user->getId() && $this->userExpirationManager->isUserExpired($user->getId())) {
59+
if ($user->getId() && $this->userExpirationManager->isUserExpired((string) $user->getId())) {
6060
$this->userExpirationManager->deactivateExpiredUsersById([$user->getId()]);
6161
throw new AuthenticationException(
6262
__(

app/code/Magento/Shipping/Model/Simplexml/Element.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class Element extends \Magento\Framework\Simplexml\Element
2020
* @param string $namespace If specified, the namespace to which the attribute belongs.
2121
* @return void
2222
*/
23-
#[\ReturnTypeWillChange]
24-
public function addAttribute($name, $value = null, $namespace = null)
23+
public function addAttribute($name, $value = null, $namespace = null): void
2524
{
2625
$value = $value !== null ? $this->xmlentities($value) : '';
2726
parent::addAttribute($name, $value, $namespace);
@@ -35,8 +34,7 @@ public function addAttribute($name, $value = null, $namespace = null)
3534
* @param string $namespace If specified, the namespace to which the child element belongs.
3635
* @return \Magento\Shipping\Model\Simplexml\Element
3736
*/
38-
#[\ReturnTypeWillChange]
39-
public function addChild($name, $value = null, $namespace = null)
37+
public function addChild($name, $value = null, $namespace = null): self
4038
{
4139
if ($value !== null) {
4240
$value = $this->xmlentities($value);

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,10 +1756,10 @@ public function getColumnCreateByDescribe($columnData)
17561756
if ($columnData['DEFAULT'] !== null && $type != Table::TYPE_TEXT) {
17571757
$options['default'] = $this->quote($columnData['DEFAULT']);
17581758
}
1759-
if (strlen($columnData['SCALE']) > 0) {
1759+
if ($columnData['SCALE'] !== null && strlen($columnData['SCALE']) > 0) {
17601760
$options['scale'] = $columnData['SCALE'];
17611761
}
1762-
if (strlen($columnData['PRECISION']) > 0) {
1762+
if ($columnData['SCALE'] !== null && strlen($columnData['PRECISION']) > 0) {
17631763
$options['precision'] = $columnData['PRECISION'];
17641764
}
17651765

lib/internal/Magento/Framework/DB/Ddl/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ public function addColumn($name, $type, $size = null, $options = [], $comment =
381381
$precision = $size[0];
382382
$scale = $size[1];
383383
}
384-
} elseif (preg_match('#^(\d+),(\d+)$#', $size, $match)) {
384+
} elseif (preg_match('#^(\d+),(\d+)$#', $size ?? '', $match)) {
385385
$precision = $match[1];
386386
$scale = $match[2];
387387
}

lib/internal/Magento/Framework/Stdlib/DateTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function formatDate($date, $includeTime = true)
7070
*/
7171
public function isEmptyDate($date)
7272
{
73-
return preg_replace('#[ 0:-]#', '', $date) === '';
73+
return !$date || preg_replace('#[ 0:-]#', '', $date) === '';
7474
}
7575

7676
/**

lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ public function scopeTimeStamp($scope = null)
262262
/**
263263
* @inheritdoc
264264
*/
265-
public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null)
265+
public function isScopeDateInInterval($scope, $dateFrom = '', $dateTo = '')
266266
{
267267
if (!$scope instanceof ScopeInterface) {
268268
$scope = $this->_scopeResolver->getScope($scope);
269269
}
270270

271271
$scopeTimeStamp = $this->scopeTimeStamp($scope);
272-
$fromTimeStamp = strtotime($dateFrom);
273-
$toTimeStamp = strtotime($dateTo);
272+
$fromTimeStamp = strtotime((string) $dateFrom);
273+
$toTimeStamp = strtotime((string) $dateTo);
274274
if ($dateTo) {
275275
// fix date YYYY-MM-DD 00:00:00 to YYYY-MM-DD 23:59:59
276276
$toTimeStamp += 86400;

lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getConfigTimezone($scopeType = null, $scopeCode = null);
122122
* @param string|null $dateTo
123123
* @return bool
124124
*/
125-
public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null);
125+
public function isScopeDateInInterval($scope, $dateFrom = '', $dateTo = '');
126126

127127
/**
128128
* Format date according to date and time formats, locale, timezone and pattern.

lib/internal/Magento/Framework/Url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ protected function _setRoutePath($data)
504504
}
505505

506506
$this->unsetData('route_path');
507-
$routePieces = explode('/', $data);
507+
$routePieces = explode('/', $data ?? '');
508508

509509
$route = array_shift($routePieces);
510510
if ('*' === $route) {

0 commit comments

Comments
 (0)