Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repositories are sorted alphabetically (2.30.0) #1059

Closed
mbrodala opened this issue Feb 27, 2023 · 4 comments · Fixed by ergebnis/json-normalizer#858
Closed

Repositories are sorted alphabetically (2.30.0) #1059

mbrodala opened this issue Feb 27, 2023 · 4 comments · Fixed by ergebnis/json-normalizer#858
Assignees
Labels

Comments

@mbrodala
Copy link

mbrodala commented Feb 27, 2023

Steps required to reproduce the problem

  1. Have a composer.json with repositories
  2. Have at least one local repository and another repository
  3. Give local a name which alphabetically follows the other repository (e.g. local for local and foo for a custom VCS package)

So given a composer.json like this:

{
    "repositories": {
        "local": {
            "type": "path",
            "url": "./packages/*/"
        },
        "foo": {
            "type": "vcs",
            "url": "..."
        }
    }
}

Expected Result

  • the repositories order is left unchanged on normalization (example above: local stays before foo)

Actual Result

  • the repositories are sorted alphabetically which must not happen (example above: foo is sorted before local)

See https://getcomposer.org/doc/04-schema.md#repositories

Note: Order is significant here. When looking for a package, Composer will look from the first to the last repository, and pick the first match.

@mbrodala mbrodala changed the title Repositories are sorted alphabetically Repositories are sorted alphabetically (2.30.0) Feb 27, 2023
@localheinz localheinz self-assigned this Feb 27, 2023
@localheinz localheinz added the bug label Feb 27, 2023
@localheinz
Copy link
Member

@mbrodala

Interesting, I did not know that repositories could be an array or an object.

Thank you for opening an issue!

@localheinz
Copy link
Member

@mbrodala
Copy link
Author

Thanks a lot for the fix!

@localheinz
Copy link
Member

You are welcome, @mbrodala!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants