Skip to content

array_multisort does not sort #104

Closed
@dmecke

Description

@dmecke

Given the following phpunit test case:

$integers = [3, 1, 2];

$sort = [];
foreach ($integers as $k => $value) {
    $sort[$k][] = $value;
}
array_multisort($sort, SORT_ASC, $integers);

Assert::assertSame(1, $integers[0]);
Assert::assertSame(2, $integers[1]);
Assert::assertSame(3, $integers[2]);

it passes with php's native array_mulitsort. Using Safe\array_multisort it fails, though. The array $integers is left unchanged. In the documentation (and therefore in safe) the third parameter is not a reference while php actually treats it as one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions