flex icon indicating copy to clipboard operation
flex copied to clipboard

Explaination about main.9999999 in symfony.lock

Open alchy58 opened this issue 3 years ago • 2 comments

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

alchy58 avatar Oct 08 '22 15:10 alchy58

@alchy58 did you manage to figure it out how to proceed with dev- branches and changing them frequently while having proper version of the recipe in the symfony.lock?

gspirov avatar Jun 21 '23 09:06 gspirov

Running into this and it's blocking composer use generally.

In VersionParser.php line 186: Invalid version string "9999999.9999999"

rnbw-spctrm avatar Jun 01 '24 02:06 rnbw-spctrm