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

Laravel 6+7 composer create-project fails on PHP 8.1 #40339

Closed
asgrim opened this issue Jan 11, 2022 · 3 comments
Closed

Laravel 6+7 composer create-project fails on PHP 8.1 #40339

asgrim opened this issue Jan 11, 2022 · 3 comments

Comments

@asgrim
Copy link

asgrim commented Jan 11, 2022

  • Laravel Version: 6.20.43 and 7.30.6
  • PHP Version: 8.1.1 (applies to any 8.1.* series)
  • Database Driver & Version: n/a

Description:

Installing Laravel 6 or 7 using PHP 8.1 fails, using either of the two following commands:

# Try using Laravel 6
$ composer create-project laravel/laravel:6.* test-app-6 --prefer-dist

# Try using Laravel 7
$ composer create-project laravel/laravel:7.* test-app-7 --prefer-dist

The PHP version constraint is set to ^7.2.5|^8.0 for Laravel 6 and 7, which suggests both versions are installable on PHP 8.1. This does not appear to be the case. My suspicion is that Laravel 6 and 7 were never intended to support PHP 8.1 - especially, given that Laravel 7 support ended (security - Mar 3, 2021) before PHP 8.1 was even released (Nov 25, 2021).

However, unfortunately, since these releases have already been tagged with a version constraint that is not "true", this cannot easily be undone. The steps (in isolation) that could be taken to resolve this:

  • If PHP 8.1 support was intended, add support to both series for PHP 8.1 so they are installable. I understand this may undesirable since Laravel 7 is not actually supported any more.
  • Update the version constraints for both series to something narrower, e.g. ^7.2.5|8.0.*, release a new version for each series, and delete the older tags/releases that are not installable on PHP 8.1. This is also undesirable, since deleting tags is never a good idea. Note: just releasing a new version such as laravel/laravel:6.20.2 with a constraint of php:^7.2.5|8.0.* is not enough; because Composer will still pick laravel/laravel:6.20.1 since it advertises compatibility with PHP 8.1.
  • A combination of the above; I know Laravel 7 is not supported (so doing nothing is likely an acceptable strategy). However, Laravel 6 is in "LTS" support, so should be actioned one way or another I think.

Neither are ideal solutions, and I know this discussion has been had multiple times on Twitter (which always ends well 😆).

A general ecosystem idea comes to mind; perhaps a way to mark a version as "unsupported" on Packagist; this would mean the version can be installed with composer install, but is excluded from any further composer update. This IMO is better than deleting tags; it means someone using an older version, they can still install the version they were using, but if they do a composer update it will either stay on the existing version, or update to a newer compatible release, if available. I've not done enough thought on that to work out if it is actually viable though.

Steps To Reproduce:

  • Install PHP 8.1
  • Run either composer create-project laravel/laravel:6.* test-app-6 --prefer-dist or composer create-project laravel/laravel:7.* test-app-6 --prefer-dist
@asgrim
Copy link
Author

asgrim commented Jan 11, 2022

Sorry, forgot to attach the output; it is rather long, so I put them both in a gist: https://gist.github.com/asgrim/221090b8c22129dd2a6d57eb48a0d658

@driesvints
Copy link
Member

Hi @asgrim, Laravel 6 & 7 don't support PHP 8.1, please see https://laravel.com/docs/8.x/releases#support-policy

We unfortunately won't be changing anything here. Thank you for your suggestions though 👍

@asgrim
Copy link
Author

asgrim commented Jan 11, 2022

Thanks @driesvints that helps 👍 It's a shame your PR #39163 didn't go through as that would've helped things going forward, but I appreciate the feedback. I'll exclude Laravel 6 + 7 from our build matrix on PHP 8.1. Cheers & have a great day!

asgrim added a commit to scoutapp/scout-apm-php that referenced this issue Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants