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

Environment variable not work with local repo #11409

Closed
aleksandr-shevchenko opened this issue Mar 30, 2023 · 4 comments · Fixed by #11453
Closed

Environment variable not work with local repo #11409

aleksandr-shevchenko opened this issue Mar 30, 2023 · 4 comments · Fixed by #11453
Labels
Milestone

Comments

@aleksandr-shevchenko
Copy link

Composer ver.2.5.5, Win10

Environment variables work in Windows when I use local package with "type": "path", but not work with local repo with "type": "vcs".

My composer.json:

    "repositories": [
    {
            "type": "vcs",
            "url": "d:/Rabota/PHP/_packages_/alex"
        }
    ],
    "require": {
        "alex/alex": "dev-master"
    }

work fine.

But (when MY_PHP_PATH=d:\Rabota\PHP)

    "repositories": [
    {
            "type": "vcs",
            "url": "$MY_PHP_PATH/_packages_/alex"
        }
    ],
    "require": {
        "alex/alex": "dev-master"
    }

not work.

Output of composer diagnose:

In VcsRepository.php line 191:

  No driver found to handle VCS repository $MY_PHP_PATH/_packages_/alex
@stof
Copy link
Contributor

stof commented Mar 30, 2023

I would say that they work in path only by luck (and they might not work cross-platform)

@aleksandr-shevchenko
Copy link
Author

from documentation about path

Leading tildes are expanded to the current user's home folder, and environment variables are parsed in both Windows and Linux/Mac notations.

@stof
Copy link
Contributor

stof commented Apr 12, 2023

OK, then it is not by luck.

However, for VCS repositories, I would say that this not expanding them is done on purpose as the main use case for VCS repositories is to use remove URLs, not local paths.

@Seldaek
Copy link
Member

Seldaek commented Apr 25, 2023

Right, but I think it would be pretty harmless to support them as well in VCS repo. Given we only support them at the beginning of the URL it would anyway not be supported for all https:// etc URLs, which makes it unlikely to backfire.

@Seldaek Seldaek added this to the 2.6 milestone Apr 25, 2023
Seldaek added a commit to Seldaek/composer that referenced this issue May 5, 2023
Seldaek added a commit that referenced this issue May 7, 2023
ktomk added a commit to ktomk/composer that referenced this issue Oct 16, 2023
Otherwise the URL may not be supported since 3bb191a (Add support for
env vars and ~ (for HOME) in repo paths for vcs and artifact
repositories, fixes composer#11409 (composer#11453), 2023-05-07)
ktomk added a commit to ktomk/composer that referenced this issue Oct 25, 2023
Otherwise the URL may not be supported since 3bb191a (Add support for
env vars and ~ (for HOME) in repo paths for vcs and artifact
repositories, fixes composer#11409 (composer#11453), 2023-05-07)
Seldaek pushed a commit that referenced this issue Oct 26, 2023
Otherwise the URL may not be supported since 3bb191a (Add support for
env vars and ~ (for HOME) in repo paths for vcs and artifact
repositories, fixes #11409 (#11453), 2023-05-07)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants