zaporylie/composer-drupal-optimizations

Undefined index: extra

mglaman opened this issue · 5 comments

This is weird, and new. When trying to add a dependency I am getting:

Installation failed, reverting ./composer.json to its original content.

                          
  [ErrorException]        
  Undefined index: extra  
                          

Exception trace shows it is due to this plugin

Exception trace:
 () at /Users/mglaman/Drupal/sites/contribkanban.com/vendor/zaporylie/composer-drupal-optimizations/src/Cache.php:76
 Composer\Util\ErrorHandler::handle() at /Users/mglaman/Drupal/sites/contribkanban.com/vendor/zaporylie/composer-drupal-optimizations/src/Cache.php:76
 zaporylie\ComposerDrupalOptimizations\Cache->removeLegacyTags() at /Users/mglaman/Drupal/sites/contribkanban.com/vendor/zaporylie/composer-drupal-optimizations/src/Cache.php:38
 zaporylie\ComposerDrupalOptimizations\Cache->read() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:348
 Composer\Repository\ComposerRepository->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:213
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:202
 Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:173
 Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:153

:) Looks like this was fixed in #18

            foreach ($specificPackage as $version => $composerJson) {
                if (null !== $alias = (isset($composerJson['extra']['branch-alias'][$version]) ? $composerJson['extra']['branch-alias'][$version] : null)) {
                    $normalizedVersion = $this->versionParser->normalize($alias);
                } elseif (null === $normalizedVersion = isset($composerJson['version_normalized']) ? $composerJson['version_normalized'] : null) {
                    continue;
                }

symfony/symfony removed branch alias today causing this issue. Please see #18 for context.

@zaporylie sorry, I'm so used to Drupal issue queues showing recently fixed issues. I need to train myself to click "Closed" and see recent closed issues.

No worries. I should probably make it more visible via Readme.md that there was an issue and how to solve it 🤔

Hm, I'm not sure how best to. A lot of folks are going to hit this and go "AHHH WHY AND WHAT?!" Hopefully the closed/existing issues get indexed at a decent pace. Maybe a tweeters announcement is the best that can be done