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

Bug: "wrong" PHP 8.3 version installed when setup-php used twice in workflow #895

Closed
1 of 2 tasks
jrfnl opened this issue Dec 18, 2024 · 7 comments
Closed
1 of 2 tasks
Assignees
Labels
bug Something isn't working

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Dec 18, 2024

Describe the bug

When installing PHP, setup-php will always install the latest released version of specific PHP minor.

The bug I'm currently seeing is one where this is not happening when setup-php is used twice in a workflow and the second time PHP 8.3 is being installed.

I've done some investigating and it looks like this issue only occurs with PHP 8.3.

This is a table with my findings (can be verified via the GH Actions logs link posted below):

PHP Single install Double install
7.2 7.2.34 7.2.34
7.3 7.3.33 7.3.33
7.4 7.4.33 7.4.33
8.0 8.0.30 8.0.30
8.1 8.1.31 8.1.31
8.2 8.2.26 8.2.26
8.3 8.3.14 8.3.6 :point_left
8.4 8.4.1 8.4.1

Version

  • v2
  • v1

Runners

GitHub Hosted

Operating systems

ubuntu-latest

PHP versions

8.3

To Reproduce

I've testing the issue in isolation - a demo of the issue can be found here:

Expected behavior

I expected PHP 8.3.14 to be installed, but I got PHP 8.3.6 instead.

Screenshots/Logs

image

Additional context

Would love to submit a PR, but I searched the code base and couldn't find any direct clue as to why this is happening.

Are you willing to submit a PR?

No

@jrfnl jrfnl added the bug Something isn't working label Dec 18, 2024
@shivammathur
Copy link
Owner

@jrfnl

Please test if this happens even if you set update env to true in the setup-php step.

@shivammathur
Copy link
Owner

I have identified why this happens.

We have a logic to force update if the ondrej/php PPA is not present on the runner (ubuntu-22.04 and ubuntu-24.04). So when it runs for the first time with PHP 7.4, it adds that PPA and on the next run, now that it has the PPA update is not set to true.

I will try to fix this in the next release that we maintain the update logic on subsequent runs in the same job, but the workaround to specify update: true env should help in avoiding this all together.

@jrfnl
Copy link
Contributor Author

jrfnl commented Dec 18, 2024

@shivammathur Thank you - as always - for your super-fast response.

I've added a second commit to the reproduction branch and can confirm that adding the update env variable fixes the issue.

The thing I find weird about it, is that the issue only occured with PHP 8.3, not with any of the other PHP versions ?

I very much appreciate that you are looking into the root cause of this, but yes, for my specific usecase, the update env will fix this.

@shivammathur
Copy link
Owner

ubuntu-24.04 has php 8.3.6 preinstalled.
https://packages.ubuntu.com/noble/php8.3

@jrfnl
Copy link
Contributor Author

jrfnl commented Dec 18, 2024

@shivammathur Ah, that explains a lot! Thanks for letting me know.

@shivammathur
Copy link
Owner

Fixed in cdfde5e. Will be in the next release.

@shivammathur shivammathur added the awaiting-release Added/Fixed and tested, awaiting release label Dec 23, 2024
@shivammathur
Copy link
Owner

Released in 2.32.0.

@shivammathur shivammathur removed the awaiting-release Added/Fixed and tested, awaiting release label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants