8000 Error-prone sort behaviour on loadMigrations · Issue #1172 · doctrine/migrations · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Error-prone sort behaviour on loadMigrations #1172
Closed
@asysrieke

Description

@asysrieke

Bug Report

Q A
BC Break no
Version 3.1.4

Summary

The order of loaded migrations on the abstract MigrationFinder is misleading and probably not as intended.

Current behavior

In Doctrine\Migrations\Finder\Finder::loadMigrations() migration classes are loaded by submitted migration files.
After loading the classes they are iterated and transferred into the $versions Array.
The $versions array is then sorted by key with SORT_STRING option and returned.
As the array is sorted by key with SORT_STRING option and you have more than 10 migrations, the returned versions array will be in misleading order as follows:
[0] => Version 0
[1] => Version 1
[10] => Version 10
[11] => Version 11
[2] => Version 2

The screenshot shows the unsorted version array and the sorted one.
2021-06-23 17_48_58-Window

How to reproduce

Add more than 10 migrations to your project and dump the output of loadMigrations()

Expected behavior

I would expect the returned array to be sorted by the version number or not sorted at all.

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

      0