Problem/Motivation

\Drupal\Core\Composer\Composer::preAutoloadDump contains this code block:

    if ($repository->findPackage('symfony/http-kernel', $constraint)) {
      $autoload['classmap'] = array_merge($autoload['classmap'], [
        $vendor_dir . '/symfony/http-kernel/HttpKernel.php',
        $vendor_dir . '/symfony/http-kernel/HttpKernelInterface.php',
        $vendor_dir . '/symfony/http-kernel/TerminableInterface.php',
      ]);
    }
    if ($repository->findPackage('symfony/http-kernel', $constraint)) {
      $autoload['classmap'] = array_merge($autoload['classmap'], [
        $vendor_dir . '/symfony/http-kernel/HttpKernel.php',
        $vendor_dir . '/symfony/http-kernel/HttpKernelInterface.php',
        $vendor_dir . '/symfony/http-kernel/TerminableInterface.php',
      ]);
    }

I think one time will be enough.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Spokje created an issue. See original summary.

Spokje’s picture

Spokje’s picture

Title: \Drupal\Core\Composer\Composer::preAutoloadDump contains duplicate if statement » [PP-1] \Drupal\Core\Composer\Composer::preAutoloadDump contains duplicate if statement
Related issues: +#3076684: Remove deprecated vendor cleanup scripts

Postponing on the commit of #3076684: Remove deprecated vendor cleanup scripts after which we'll need a separate 10.0.x/10.1.x patch.

Spokje’s picture

Status: Active » Postponed
Spokje’s picture

Spokje’s picture

Assigned: Spokje » Unassigned
Status: Postponed » Needs review
Spokje’s picture

Title: [PP-1] \Drupal\Core\Composer\Composer::preAutoloadDump contains duplicate if statement » \Drupal\Core\Composer\Composer::preAutoloadDump contains duplicate if statement
longwave’s picture

Status: Needs review » Needs work

The 10.x patch is removing the wrong thing:

+++ b/core/lib/Drupal/Core/Composer/Composer.php
@@ -65,12 +65,6 @@ public static function preAutoloadDump(Event $event) {
-    if ($repository->findPackage('symfony/dependency-injection', $constraint)) {

symfony/http-kernel is the duplicate block.

Spokje’s picture

Ouch, nasty. Great catch @longwave, that'll teach me not do a quick patch before ending the day...

arunkumark’s picture

Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks - #2 and #9 are RTBC.

alexpott’s picture

Category: Task » Bug report
Status: Reviewed & tested by the community » Fixed

Committed and pushed 6793e2ea36 to 10.1.x and b2f6bba562 to 10.0.x. Thanks!
Committed and pushed c90ec155ac to 9.5.x and 17fcbdbbb9 to 9.4.x. Thanks!

Duplicate code is a bug.

  • alexpott committed ca19704 on 10.1.x
    Issue #3293051 by Spokje, longwave: \Drupal\Core\Composer\Composer::...

  • alexpott committed b2f6bba on 10.0.x
    Issue #3293051 by Spokje, longwave: \Drupal\Core\Composer\Composer::...

  • alexpott committed c90ec15 on 9.5.x
    Issue #3293051 by Spokje, longwave: \Drupal\Core\Composer\Composer::...

  • alexpott committed 17fcbdb on 9.4.x
    Issue #3293051 by Spokje, longwave: \Drupal\Core\Composer\Composer::...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.