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

PHP 8.0 compatibility #2087

Closed
LordSimal opened this issue Nov 1, 2020 · 13 comments
Closed

PHP 8.0 compatibility #2087

LordSimal opened this issue Nov 1, 2020 · 13 comments

Comments

@LordSimal
Copy link
Contributor

LordSimal commented Nov 1, 2020

Details

Question Answer
Relevant Bolt Version 4.1.4
Install type Composer install
BC Break no
PHP version 8.0 RC3
Web server Nginx
For UX/UI issues Latest Chrome

Reproduction

Bug summary

BoltCMS currently breaks when trying to run it on PHP 8.0 RC3

Specifics

After installing the current PHP 8.0 RC3 release I got the following error when trying to access the frontpage

image

Compile Error: Cannot declare interface Psr\Container\ContainerInterface, because the name is already in use

This is related to symfony/symfony#36676

Basically you can either have the psr/container interface installed via composer or as a PHP module.

To circumvent that we need to add the following to the composer.json

{
    "replace": {
        "psr/container": "1.*"
    }
}

After a new composer install the following error occurs

image

syntax error, unexpected token "match"

This is realted to willdurand/Negotiation#106

The module https://github.com/willdurand/Negotiation is being required by api-platform/core which is present in our composer.json

But as can be seen in that Pull Request there is no stable release for that fix at the moment.

I tried that fix on my instance and BoltCMS works after these changes.

image

I would say we'll have to wait for a stable release and then adjust our TravisCI tests to check if other things break as well under 8.0

@LordSimal
Copy link
Contributor Author

PHP 8.0 has just been released
https://www.php.net/archive/2020.php#2020-11-26-3

@LordSimal
Copy link
Contributor Author

https://github.com/willdurand/Negotiation/releases/tag/3.0.0 has been released, so there should be no problem to at least start a Travis CI Test started with the needed changes.

@bobdenotter
Copy link
Member

@LordSimal Sure! Let's see how it goes! #2184

@LordSimal
Copy link
Contributor Author

LordSimal commented Dec 4, 2020

I just retried this whole 8.0 problem again.
Currently since api-platform/core still allows 2.0 to be installed (which is not 8.0 compatible) I still get the match error because composer/CLI is running with PHP 7.4 on my server, not 8.0

But at least Bolt is working with "Web-Server PHP 8.0" when requiring the 3.0 version in the root composer.json with
composer require willdurand/negotiation:^3.0

Running Composer 2.0.8 with 8.0 i still get problems with bolt/common

 php8.0 /usr/bin/composer update -W
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "^5.1"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - bolt/core[4.1.5, ..., 4.1.x-dev] require bolt/common ^2.1.10 -> satisfiable by bolt/common[2.1.10].
    - bolt/core[4.0.0-rc.27, ..., 4.1.4] require bolt/common ^2.1.6 -> satisfiable by bolt/common[2.1.6, ..., 2.1.10].
    - bolt/core 4.0.0-alpha3 requires symfony/asset ^4.2 -> found symfony/asset[v4.2.0-BETA1, ..., 4.4.x-dev] but these were not loaded, likely because it conflicts with another require.
    - bolt/core[4.0.0-beta.1, ..., 4.0.0-beta.4.4] require symfony/asset ^4.3 -> found symfony/asset[v4.3.0-BETA1, ..., 4.4.x-dev] but these were not loaded, likely because it conflicts with another require.
    - bolt/core[4.0.0-beta.4.5, ..., 4.0.0-rc.26] require symfony/asset ^4.4 -> found symfony/asset[v4.4.0-BETA1, ..., 4.4.x-dev] but these were not loaded, likely because it conflicts with another require.
    - bolt/common[2.1.6, ..., 2.1.10] require php ^7.1 -> your php version (8.0.0) does not satisfy that requirement.
    - Root composer.json requires bolt/core ^4.0 -> satisfiable by bolt/core[4.0.0-alpha3, ..., 4.1.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

@LordSimal
Copy link
Contributor Author

I see #2214 would already fix this

@bobdenotter
Copy link
Member

Are you sure you're on master? https://github.com/bolt/core/blob/master/composer.json#L14

@LordSimal
Copy link
Contributor Author

Nope, that was my problem. After putting bolt/core to dev-master I now get

-> % php8.0 /usr/bin/composer update -W
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "^5.1"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpdocumentor/reflection-docblock[4.3.0, ..., 4.3.4] require php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
    - bolt/core dev-master requires phpdocumentor/reflection-docblock ^4.3 -> satisfiable by phpdocumentor/reflection-docblock[4.3.0, ..., 4.3.4].
    - Root composer.json requires bolt/core dev-master -> satisfiable by bolt/core[dev-master].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

@LordSimal
Copy link
Contributor Author

Seems like we need to update phpdocumentor/reflection-docblock to ^5.0
https://github.com/phpDocumentor/ReflectionDocBlock

@LordSimal
Copy link
Contributor Author

I hate composer when it doesn't show every dependency problem at once.
Now after the phpdocumentor/reflection-docblock is being fixed I get another problem with

  Problem 1
    - tightenco/collect[v7.25.0, ..., v7.26.1] require php ^7.1.3 -> your php version (8.0.0) does not satisfy that requirement.
    - bolt/core dev-master requires tightenco/collect ^7.25 -> satisfiable by tightenco/collect[v7.25.0, v7.26.1].
    - Root composer.json requires bolt/core dev-master -> satisfiable by bolt/core[dev-master].

@LordSimal
Copy link
Contributor Author

To be clear this just occurs when executing composer with PHP 8.0

@milosa
Copy link

milosa commented Dec 17, 2020

I hate composer when it doesn't show every dependency problem at once.
Now after the phpdocumentor/reflection-docblock is being fixed I get another problem with

  Problem 1
    - tightenco/collect[v7.25.0, ..., v7.26.1] require php ^7.1.3 -> your php version (8.0.0) does not satisfy that requirement.
    - bolt/core dev-master requires tightenco/collect ^7.25 -> satisfiable by tightenco/collect[v7.25.0, v7.26.1].
    - Root composer.json requires bolt/core dev-master -> satisfiable by bolt/core[dev-master].

This still happens.
Version 8 of tightenco/collect supports php 8.

@LordSimal
Copy link
Contributor Author

yea but I dont know if we can just upgrade tigthenco/collecto from 7 to 8 without major changes.
I have never worked with collections.

@bobdenotter
Copy link
Member

This is another issue: Ne-Lexa/php-zip#78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants