Skip to content

The new composer breaks autoloading #32309

@KubqoA

Description

@KubqoA
  • Laravel Version: 7.5.0
  • PHP Version: 7.4.4
  • Database Driver & Version: psql 12.2

Description:

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:

  • Added more info to vendor/composer/installed.json, a dev key stores whether dev requirements were installed, and every package now has an install-path key with its install location

Steps To Reproduce:

  1. Update composer via: composer selfupdate --snapshot
  2. I deleted composer.lock and vendor directory, however this doesn't seem to affect this
  3. Run composer update, which should fail when the postAutoloadDump scripts run, more specifically the @php artisan package:discover --ansi

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions