Skip to content

Commit

Permalink
Fixed null parameter warning in DataFlow Profiles (#3827)
Browse files Browse the repository at this point in the history
Co-authored-by: Ng Kiat Siong <[email protected]>
  • Loading branch information
addison74 and kiatng authored Feb 27, 2024
1 parent fef1c08 commit 63293af
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getValue($key, $default = '', $defaultNew = null)
}

$value = $this->getData($key);
return $this->escapeHtml(strlen($value) > 0 ? $value : $default);
return $this->escapeHtml($value !== null && strlen($value) > 0 ? $value : $default);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Dataflow/Model/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ protected function _beforeSave()
{
parent::_beforeSave();
$actionsXML = $this->getData('actions_xml');
if (strlen($actionsXML) < 0 &&
// @phpstan-ignore-next-line because of https://github.com/phpstan/phpstan/issues/10570
if ($actionsXML !== null && strlen($actionsXML) < 0 &&
@simplexml_load_string('<data>' . $actionsXML . '</data>', null, LIBXML_NOERROR) === false
) {
Mage::throwException(Mage::helper('dataflow')->__("Actions XML is not valid."));
Expand Down
10 changes: 0 additions & 10 deletions phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2915,16 +2915,6 @@ parameters:
count: 1
path: app/code/core/Mage/Dataflow/Model/Convert/Profile/Abstract.php

-
message: "#^Comparison operation \"\\<\" between int\\<0, max\\> and 0 is always false\\.$#"
count: 1
path: app/code/core/Mage/Dataflow/Model/Profile.php

-
message: "#^Result of && is always false\\.$#"
count: 1
path: app/code/core/Mage/Dataflow/Model/Profile.php

-
message: "#^Right side of && is always true\\.$#"
count: 1
Expand Down

0 comments on commit 63293af

Please sign in to comment.