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

Psalm 4.20.0 PHAR does not report correction version #7606

Closed
sebastianbergmann opened this issue Feb 8, 2022 · 5 comments · Fixed by #8770 or #8997
Closed

Psalm 4.20.0 PHAR does not report correction version #7606

sebastianbergmann opened this issue Feb 8, 2022 · 5 comments · Fixed by #8770 or #8997
Labels

Comments

@sebastianbergmann
Copy link
Contributor

$ wget https://github.com/vimeo/psalm/releases/download/4.20.0/psalm.phar
--2022-02-08 15:13:46--  https://github.com/vimeo/psalm/releases/download/4.20.0/psalm.phar
.
.
.
2022-02-08 15:13:48 (11.2 MB/s) - ‘psalm.phar’ saved [11749531/11749531]

Actual

$ php psalm.phar --version     
Psalm 4.x-dev@

Expected

$ php psalm.phar --version     
Psalm 4.20.0
@psalm-github-bot
Copy link

Hey @sebastianbergmann, can you reproduce the issue on https://psalm.dev ?

@mind-bending-forks
Copy link

I've had a quick look. I note that the version number is set using the PackageVersions dependency, which appears to try to extract the version number from the composer.lock file. I've extracted my phar archive and I observed that there is no composer.json or compser.lock file in it. This is probably the cause of the problem. Maybe someone just needs to include the composer.lock file in the phar archive to resolve this.

It's a pain if it's not possible to determine the version of psalm from the phar archive. Please could someone investigate the above?

@orklah
Copy link
Collaborator

orklah commented Aug 8, 2022

Interesting. I don't have much experience using phar, would you mind providing a PR for that? It would be cool to have this fixed indeed

@mind-bending-forks
Copy link

I don't have experience of building phars (only using them!) and I don't have any experience/knowledge of the inner workings of psalm either. So, I'm starting from nothing here. I've had a dig around the code, and as far as I can tell, the building of the phar is outsourced to a dependency called box:

The box documentation says that, by default, composer.json and composer.lock files are excluded: https://github.com/box-project/box/blob/4.0.2/doc/configuration.md#excluding-the-composer-files-exclude-composer-files They can be included by setting exclude-composer-files to false.

So, a possible solution would be to add "exclude-composer-files": false to box.json.dist. This might fix the problem, but I couldn't say for sure without testing.

weirdan added a commit to weirdan/psalm that referenced this issue Nov 26, 2022
Compatibility between `ocramius/package-versions`,
`composer/package-versions-deprecated`, `composer-runtime-api` and
`humbug/box` (with `humbug/scoper` further complicating things)has been
always a problematic area. So instead of trying to keep up with all the
changes in all of those packages, we will now bake the version data (for
the packages we need) into the PHAR file itself.

Fixes vimeo#7606
Fixes vimeo#5399
weirdan added a commit that referenced this issue Nov 26, 2022
@ghost
Copy link

ghost commented Dec 23, 2022

Some months ago I opened issue #7921 and I was told its a duplicate of this issue, which appears "closed".

But even today with version 5.4.0 the --version parameter is broken:

$ psalm --version
Psalm dev-master@

Still no real version, I expected to see 5.4.0 and not dev-master@.

Thank you.

PS:
This means I can never be sure which version I have running on my system, I need to manually write down the version I've downloaded.

@weirdan weirdan reopened this Dec 23, 2022
weirdan added a commit to weirdan/psalm that referenced this issue Dec 23, 2022
We were overriding the root version with COMPOSER_ROOT_VERSION, so all
PHARs had `dev-master` as the version for `vimeo/psalm` baked in.

Fixed vimeo#7606
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.

4 participants