Altis 12 not fully compatible with PHP 7.4 due to psr/log subdependency
Steps to reproduce:
- We updated a dev site to Altis 12, with all dependencies, which upgraded
psr/logfrom1.1.4to3.0.0. - We deployed this branch to a dev environment still running PHP 7.4, per the docs page which states that v12 should support both PHP 7.4 and PHP 8.
- Login stopped working on Development, with an error,
syntax error, unexpected '|', expecting variable (T_VARIABLE)
- That error occurred in file
vendor/psr/log/src/LoggerInterface.phpwithinpsr/logv3.0.
psr/log versions since 2.0 specifically requires php: >=8.0.0, per packagist and the package's composer.json.
composer why output showing that psr/log evaluates to v3 in Altis 12:
composer why -t psr/log
psr/log 3.0.0 Common interface for logging libraries
└──monolog/monolog 2.8.0 (requires psr/log ^1.0.1 || ^2.0 || ^3.0)
├──altis/cloud 12.0.4 (requires monolog/monolog ^2.5)
│ └──altis/altis 12.0.0 (requires altis/cloud ^12.0.0)
│ └──humanmade/project dev-php-8-compat (requires altis/altis ^12.0.0)
├──google/apiclient v2.12.6 (requires monolog/monolog ^1.17||^2.0||^3.0)
│ └──humanmade/project dev-php-8-compat (requires google/apiclient ^2.0)
└──maxbanton/cwh v2.0.2 (requires monolog/monolog ^2.0)
└──altis/cloud 12.0.4 (requires maxbanton/cwh ^2.0)
└──altis/altis 12.0.0 (requires altis/cloud ^12.0.0)
└──humanmade/project dev-php-8-compat (requires altis/altis ^12.0.0)
Manually pinning psr/log to 1.1.4 in the Altis project's composer.json appears to resolve the issue, and I can now sign in again on that project's dev environment.
I would expect a subdependency of Altis 12 to support PHP 7.4, because 7.4 is listed as deprecated but not incompatible on the Updating PHP docs page.
Acceptance criteria:
- [ ] ...
@kadamwhite does the config section of your composer.json specify a target PHP version. Setting that is typically part of the upgrade guide so if it's set to PHP 8.0 this could happen - likely the fault of our docs not indicating this difference.
Opened documentation PR at https://github.com/humanmade/altis-documentation/pull/430 to encourage users to explicitly set that.
Rob hit the nail on the head, I was following the upgrade guide and installed Altis 12 as a part of PHP 8 preparedness. Sounds like there may NOT be a single version of Altis 12 that supports 7.4 and 8.0 without requiring a composer dependency update to be coordinated with a PHP deploy...?