Skip to content

Few weaknesses in the code #6715

@AppChecker

Description

@AppChecker

Hi!

I hope this will be helpful:

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

        if ($response === false || $response->getName() == 'Error') {
            $debugData['result'] = [
                'error' => $response->Description,
                'code' => $response->Number,
                'xml' => $response->asXML(),
            ];
...
        }

if $response is false, method asXML will be called on false

app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php

$label = $this->renderRangeLabel(
                empty($from) ? 0 : $from,
                empty($to) ? $to : $to
            );

Both parts of ternary operators are equals.

app/code/Magento/CatalogRule/Model/Rule.php

if (is_array($value)) {
                    if ($value != $array2[$key]) {
                        $result[$key] = true;
                    }
                } else {
                    if ($value != $array2[$key]) {
                        $result[$key] = true;
                    }
                }

Parts of if-conditional operator are equals.

Possible defect was found by Echelon team with AppChecker static analyzer

Metadata

Metadata

Assignees

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions