Skip to content
This repository was archived by the owner on Oct 12, 2021. It is now read-only.
This repository was archived by the owner on Oct 12, 2021. It is now read-only.

ReorderEligibilityConstraintMessageFormatter::format() can crash when returning non string value #56

@danakil

Description

@danakil

ReorderEligibilityCheckers builds an array of parameters which is passed to $this->reorderEligibilityConstraintMessageFormatter->format(...)
For example, ReorderItemPricesEligibilityChecker build a $reorderProductNamesToTotal which uses product names as key.
If you have product names with only number ("123"), then the keys are casted to integer (123).

In ReorderEligibilityConstraintMessageFormatter::format(), we have:

`
if (count($messageParameters) === 1) {
$message = array_pop($messageParameters);

        return $message;
    }`

In this cas, its crashes because the return type is not a string but an integer.
Fix:
return (string) $message;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions