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

Upgrade PHP engine from 8.3 to 8.4 #4351

Open
llaville opened this issue Dec 5, 2024 · 18 comments
Open

Upgrade PHP engine from 8.3 to 8.4 #4351

llaville opened this issue Dec 5, 2024 · 18 comments
Assignees
Labels
enhancement New feature or request

Comments

@llaville
Copy link
Collaborator

llaville commented Dec 5, 2024

Is your feature request related to a problem? Please describe.
Upgrade default PHP engine from 8.3 to 8.4

As it now available on Alpine Linux Packages : see https://pkgs.alpinelinux.org/packages?name=php84&branch=edge&repo=&arch=x86_64&origin=&flagged=&maintainer=

Describe the solution you'd like
Upgrade https://github.com/oxsecurity/megalinter/blob/main/megalinter/descriptors/php.megalinter-descriptor.yml

I can suggest a PR

Describe alternatives you've considered
No alternative exists, except if we keep on PHP 8.3

@llaville llaville added the enhancement New feature or request label Dec 5, 2024
@llaville llaville self-assigned this Dec 5, 2024
@llaville
Copy link
Collaborator Author

llaville commented Dec 5, 2024

We have still to wait ... :( Available only on edge branch and not on v3.20

@echoix
Copy link
Collaborator

echoix commented Dec 5, 2024

I just saw that alpine 3.21 was released today https://www.phoronix.com/news/Alpine-Linux-3.21

@nvuillam
Copy link
Member

nvuillam commented Dec 5, 2024

@llaville you are the PHP master here, we wait for your PR :)

@llaville
Copy link
Collaborator Author

llaville commented Dec 6, 2024

I just saw that alpine 3.21 was released today https://www.phoronix.com/news/Alpine-Linux-3.21

@echoix Thanks for this notification !

@llaville
Copy link
Collaborator Author

llaville commented Dec 6, 2024

@nvuillam As we are PHP 8.4 available on Alpine Linux v3.21 (https://pkgs.alpinelinux.org/packages?name=php84&branch=v3.21&repo=&arch=x86_64&origin=&flagged=&maintainer=) I'll prepare a PR today !

Afraid that we are to wait again, because Python 3 is not yet available on v3.21

oh yes https://pkgs.alpinelinux.org/packages?name=python3&branch=v3.21&repo=&arch=&origin=&flagged=&maintainer= but not on previous x86, x86_64 architecture

ERROR: failed to solve: python:3.12.7-alpine3.21: docker.io/library/python:3.12.7-alpine3.21: not found

@llaville
Copy link
Collaborator Author

llaville commented Dec 6, 2024

Trying directly with Docker image : https://hub.docker.com/_/php/tags?name=8.4.1-cli-alpine3.20

@llaville
Copy link
Collaborator Author

llaville commented Dec 6, 2024

I've been able to build a MegaLinter docker image with previous PHP 8.4.1 Alpine 3.20.

I'll keep you aware when all my regression tests will be over. And if OK a PR will follows

@llaville
Copy link
Collaborator Author

llaville commented Dec 6, 2024

Tip

For PHPStan user audience

As MegaLinter v8.2+ support now only PHPStan 2.0, if you have a project than raise no errors with PHPStan 1.12, I recommend to disable PHPStan error to avoid your CI to fails.

To do so: add this entry in your MegaLinter config file

PHP_PHPSTAN_DISABLE_ERRORS: true

@llaville
Copy link
Collaborator Author

llaville commented Dec 6, 2024

Tip

For Psalm user audience

As MegaLinter v8.2+ support only Psalm 5.26.x, (that is not yet PHP 8.4 compatible), I recommend to disable Psalm linter to avoid your CI to fails.

To do so: add this entry in your MegaLinter config file

DISABLE_LINTERS:
  - PHP_PSALM

@nvuillam
Copy link
Member

nvuillam commented Dec 6, 2024

@llaville plz can u add the tips in related linter descriptir linter_text property ? :) (it handles markdown ^^)

@echoix
Copy link
Collaborator

echoix commented Dec 6, 2024

For the PR, maybe just watch and wait until a Python docker image with the same Python version is published. Renovate probably won't help, as it is like two kinds of versions in the same tag, and I didn't configure it precisely enough for that. I think there's some failures with Python 3.13 still

@llaville
Copy link
Collaborator Author

llaville commented Dec 7, 2024

@echoix You've probably right : we have to wait that all elements are available, because

pkgs alpinelinux org_packages_name=python3 branch=v3 21

But no Docker image python:3.12.8-alpine3.21 (at hour I write these lines) available.
So this morning, while I still have free time, I'll continue my test on alternative solution that seems to work good !

@llaville
Copy link
Collaborator Author

llaville commented Dec 7, 2024

Related to my previous tip #4351 (comment) about Psalm, I don't think so that the project team will support PHP 8.4 in a reasonable timeframe.

Especialliy also because Psalm v6.0 is more a dream than a beginning of reality (and no PHP 8.4 is provided too)

My question to MegaLinter Core team:
If you don't have noticed yet, I'm not a big fan of Psalm, but as this linter is officially supported by ML, do we

  1. add just a note about PHP 8.4 incompatibility
  2. add an alternative by supporting both PHP 8.3 and 8.4 engine in next MegaLinter feature release

@nvuillam
Copy link
Member

nvuillam commented Dec 7, 2024

What is your preferred option ? (you are the PHP MegaLinter Core Team :D )

My main concern is to remain compliant with the more users possible, and to avoid breaking changes when we create new MegaLinter versions ^^

@llaville
Copy link
Collaborator Author

llaville commented Dec 9, 2024

@nvuillam I've tried to install Psalm 5.26 on a PHP 8.4 platform, but cannot removed DEPRECATIONS raised by new PHP 8.4 engine.

All PHP users should know how to disable it

Tip

With E_ALL = 32767 and E_DEPRECATED = 8192

php -d error_reporting=24575 vendor/bin/psalm

But in case of Psalm, it won't work because they disalowed this behaviour at https://github.com/vimeo/psalm/blob/5.26.1/src/Psalm/Internal/ErrorHandler.php#L62

So, even if we can install Psalm 5.26 on PHP 8.4 (with composer require --dev vimeo/psalm --ignore-platform-req=php ), deprecations will still be alive and will breaks Psalm results.

Other alternative is to embed both PHP 8.3 and 8.4 engine.
But even if we already did it in past, it was to suuport all PHP linters, and not just one. So I don't like this approach.

If we won't let Psalm Users behind, we have no choice than to tell us to use MegaLinter until a version (8.3.0 is the latest at day of today) that suuport PHP 8.3

WDYT ?

@nvuillam
Copy link
Member

nvuillam commented Dec 9, 2024

I'm afraid that making MegaLinter even heavier just for a linter is maybe not such a good idea :/

How is PHP 8.4 adoption ? Can't we wait that psalm becomes compliant with it before upgrading PHP in MegaLinter ?

@llaville
Copy link
Collaborator Author

I'm afraid that making MegaLinter even heavier just for a linter is maybe not such a good idea :/

👍

How is PHP 8.4 adoption ? Can't we wait that psalm becomes compliant with it before upgrading PHP in MegaLinter ?

PHP 8.4 is planned since a long time, and even if projects like mine migrated to them lately, there are no really BC breaks that should stop adoption.

When I have a look on projects that have already adopted PHP 8.4, there are no so much changes or difficulty to do so !
Only one or two deprecations categories (see https://php.watch/versions/8.4#deprecations), and the main one is well explained at https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated

Of course we can wait Psalm adopt it, but are there are no clearly roadmap, we don't know how much time !

@llaville
Copy link
Collaborator Author

I will suspend my works on it ... until next year, and I hope it will come with good news ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants