Skip to content

Commit

Permalink
rebase (OpenMage#3237)
Browse files Browse the repository at this point in the history
Co-authored-by: Fabrizio Balliano <fabrizio.balliano@gmail.com>
  • Loading branch information
sreichel and fballiano committed May 16, 2023
1 parent e0d615e commit ce8622c
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 19 deletions.
8 changes: 5 additions & 3 deletions app/code/core/Mage/Catalog/Model/Product/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,16 @@ protected function _getMemoryLimit()
$memoryLimit = "128M";
}

$value = (int)substr($memoryLimit, 0, -1);

if (substr($memoryLimit, -1) == 'K') {
return substr($memoryLimit, 0, -1) * 1024;
return $value * 1024;
}
if (substr($memoryLimit, -1) == 'M') {
return substr($memoryLimit, 0, -1) * 1024 * 1024;
return $value * 1024 * 1024;
}
if (substr($memoryLimit, -1) == 'G') {
return substr($memoryLimit, 0, -1) * 1024 * 1024 * 1024;
return $value * 1024 * 1024 * 1024;
}
return $memoryLimit;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Controller/Request/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function setPathInfo($pathInfo = null)
if ($baseUrl && $pathInfo && (stripos($pathInfo, '/') !== 0)) {
$pathInfo = '';
$this->setActionName('noRoute');
} elseif (($baseUrl !== null) && ($pathInfo === false)) {
} elseif ($baseUrl !== null && !$pathInfo) {
$pathInfo = '';
} elseif ($baseUrl === null) {
$pathInfo = $requestUri;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ public function getEscapedCSVData(array $data)
$value = (string)$value;

$firstLetter = substr($value, 0, 1);
if ($firstLetter !== false && in_array($firstLetter, ["=", "+", "-"])) {
if ($firstLetter && in_array($firstLetter, ['=', '+', '-'])) {
$data[$key] = ' ' . $value;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected function _getColumnDefinitionFromSql($sql, $column)
*
* @param string $haystack
* @param string $needle
* @param array $replacement
* @param string $replacement
* @param bool $caseInsensitive
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Payment/Model/Method/Cc.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function validateCcNum($ccNumber)
$numSum = 0;

for ($i = 0; $i < strlen($cardNumber); $i++) {
$currentNum = substr($cardNumber, $i, 1);
$currentNum = (int)substr($cardNumber, $i, 1);

/**
* Double every second digit
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Uploader/Helper/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ public function getDataMaxSize()
public function getDataMaxSizeInBytes()
{
$iniSize = $this->getDataMaxSize();
$size = substr($iniSize, 0, -1);
$size = (int)substr($iniSize, 0, -1);
$parsedSize = 0;
switch (strtolower(substr($iniSize, strlen($iniSize) - 1))) {
case 't':
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Form/Element/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getElementHtml()

if ($value = $this->getValue()) {
$values = explode(',', $value);
if (is_array($values) && count($values) == 3) {
if (count($values) === 3) {
$value_hrs = $values[0];
$value_min = $values[1];
$value_sec = $values[2];
Expand Down
10 changes: 0 additions & 10 deletions phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2300,11 +2300,6 @@ parameters:
count: 1
path: app/code/core/Mage/Core/Model/Resource/Setup.php

-
message: "#^Binary operation \"\\.\" between \\(string\\|false\\) and array results in an error\\.$#"
count: 1
path: app/code/core/Mage/Core/Model/Resource/Setup/Query/Modifier.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
Expand Down Expand Up @@ -3345,11 +3340,6 @@ parameters:
count: 1
path: app/code/core/Mage/Payment/Model/Method/Abstract.php

-
message: "#^Binary operation \"\\-\" between string and int\\<\\-9, 9\\> results in an error\\.$#"
count: 1
path: app/code/core/Mage/Payment/Model/Method/Cc.php

-
message: "#^Loose comparison using \\!\\= between ''\\|'OT' and 'SS' will always evaluate to true\\.$#"
count: 1
Expand Down

0 comments on commit ce8622c

Please sign in to comment.