Skip to content

Explaination about main.9999999 in symfony.lockΒ #953

@alchy58

Description

@alchy58

Hello,

I'm developing a bundle and requires it in a project using a dev-main version.
When the Flex Downloader compares bundle version and recipe version, it transforms the bundle "dev-main" version into "main.9999999"

The recipe is well installed, so it's the bundle.

Except maybe that the symfony.lock is updated with "main.9999999" as the package version. The recipe version is good.

When removing the bundle, composer fails with the error "Invalid version string "main.9999999", as it should be "dev-main" like in the composer.json file.

If I set manually "dev-main" as the bundle version in symfony.lock, the composer remove works well.

I wonder to have more explanations about dumping a modified version into symfony.lock if it's the wanted behavior. In this case, the official documentation may lack of informations about developing recipes for bundle having dev-main version.

Otherwise I would propose to update the Flex\Downloaded so the symfony.lock version remains the composer.json version. Either the sanitized $version can be renamed in $sanitizedVersion or somewhat more explicit

Flex\Downloader

                $sanitizedVersion = explode('.', preg_replace('/^dev-|^v|\.x-dev$|-dev$/', '', $version));
                $sanitizedVersion = $sanitizedVersion[0].'.'.($sanitizedVersion[1] ?? '9999999');

                foreach (array_reverse($recipeVersions) as $v => $endpoint) {
                    if (version_compare($sanitizedVersion, $v, '<')) {

Or the original $version may be renamed into $packageVersion or $composerVersion.

Thank you for returns

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