There is a new composer version available and although it's currently a snapshot and not a stable release it breaks the artisan package:discover command, which fails on this line in the PackageManifest class.
The current structure of the installed.json has changed. Previously it was:
[
{package1},
{package2}
]
However, now it has changed to:
{
"packages": [
{package1},
{package2}
],
"dev": true
}
thus the line fails as the $packages array isn't no longer a direct array of the available packages.
A quick fix, is to append on the previously linked line after the json_decode function call ['packages'], but this would break the functionality for older versions of composer.
This change in structure is also present in the changelog for composer:
composer selfupdate --snapshotcomposer.lock and vendor directory, however this doesn't seem to affect thiscomposer update, which should fail when the postAutoloadDump scripts run, more specifically the @php artisan package:discover --ansiThanks for reporting. Marking this as a bug even though it's for an unreleased composer version.
I guess we can easily check if the $packages variable has a packages key and use that instead.
I can make a PR for that, if it would help you :)
Would be cool. I think we just need to do the following adjustments:
if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) {
$installed = json_decode($this->files->get($path), true);
$packages = $installed['packages'] ?? $installed;
}
Please send to 6.x, thanks!
Fixed in #32310
@driesvints I am getting the same issue in Plesk stable version on composer
@driesvints shouldn't this, however, also get fixed for 7.x? Or it will, but this PR will suffice for that?
@KubqoA 6.x is merged into 7.x regularly so it gets all of the fixes from 6.x
Oh sweet :+1: ! Thanks. Have a nice day :slightly_smiling_face:
New tags of Laravel 5.5, 5.6, 5.7, 5.8, 6, and 7 will go out tomorrow, so people can continue to deploy their code with Composer v2.
Most helpful comment
Thanks for reporting. Marking this as a bug even though it's for an unreleased composer version.
I guess we can easily check if the
$packagesvariable has apackageskey and use that instead.