composer: ErrorException: Undefined index: extra (impossible to composer update)

My composer.json, running composer 1.8.4:

{
    "name": "yproximite/yprox",
    "license": "proprietary",
    "description": "yProximite CMS: yProx",
    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.packagist.com/yproximite/"
        },
        {
            "packagist.org": false
        },
        {
            "type": "path",
            "url": "../packages/common"
        }
    ],
    "require": {
        "php": ">=7.2",
        "a2lix/translation-form-bundle": "^2.4.2",
        "algatux/influxdb-bundle": "^2.1",
        "algolia/algoliasearch-client-php": "^1.27",
        "aws/aws-sdk-php-symfony": "^2.0",
        "beberlei/doctrineextensions": "^1.1",
        "cocur/slugify": "^3.1",
        "cspoo/swiftmailer-mailgun-bundle": "^1.1",
        "doctrine/doctrine-migrations-bundle": "v2.0.0-alpha1",
        "doctrine/migrations": "^2.0@dev",
        "egulias/email-validator": "^2.1",
        "exercise/htmlpurifier-bundle": "^1.0",
        "friendsofsymfony/ckeditor-bundle": "^1.1",
        "friendsofsymfony/jsrouting-bundle": "^2.2",
        "friendsofsymfony/user-bundle": "^2.1",
        "google/apiclient": "^2.2",
        "guzzlehttp/guzzle": "^6.3",
        "imagine/imagine": "^0.7.1",
        "incenteev/composer-parameter-handler": "^2.1",
        "iron-io/iron_mq": "^4.0",
        "iron-io/iron_worker": "^2.0",
        "knplabs/doctrine-behaviors": "^1.5",
        "knplabs/knp-components": "^1.3",
        "knplabs/knp-menu": "^2.3",
        "knplabs/knp-menu-bundle": "^2.2",
        "knplabs/knp-paginator-bundle": "^2.8",
        "knplabs/knp-snappy-bundle": "^1.5",
        "knplabs/knp-time-bundle": "^1.8",
        "kraken-io/kraken-php": "^1.6",
        "league/csv": "^9.1",
        "league/flysystem-aws-s3-v3": "^1.0",
        "lexik/jwt-authentication-bundle": "^2.5",
        "liip/imagine-bundle": "^2.1",
        "misd/phone-number-bundle": "^1.3",
        "myclabs/deep-copy": "^1.8",
        "nao-pon/flysystem-google-drive": "^1.1",
        "nelmio/cors-bundle": "^1.5",
        "ninsuo/symfony-collection": "^2.1",
        "oneup/flysystem-bundle": "^3.0",
        "ornicar/gravatar-bundle": "^1.3",
        "overblog/graphql-bundle": "^0.11.3",
        "overblog/graphql-php-generator": "^0.7.3",
        "php-http/guzzle6-adapter": "^1.1",
        "php-http/httplug-bundle": "^1.11",
        "php-translation/symfony-bundle": "^0.8.0",
        "phpoffice/phpspreadsheet": "^1.4",
        "predis/predis": "^1.1",
        "sensio/framework-extra-bundle": "^5.2",
        "sentry/sentry-symfony": "^2.0",
        "snc/redis-bundle": "3.x-dev",
        "stof/doctrine-extensions-bundle": "^1.3",
        "storefactory/zoho-subscription-bundle": "^3.0",
        "symfony-cmf/routing-bundle": "^2.1",
        "symfony/asset": "*",
        "symfony/flex": "^1.0",
        "symfony/form": "*",
        "symfony/framework-bundle": "*",
        "symfony/lock": "*",
        "symfony/monolog-bundle": "^3.3",
        "symfony/orm-pack": "^1.0",
        "symfony/proxy-manager-bridge": "*",
        "symfony/security-bundle": "*",
        "symfony/swiftmailer-bundle": "^3.2",
        "symfony/translation": "*",
        "symfony/twig-bundle": "*",
        "symfony/validator": "*",
        "tristanbes/my-poseo-bundle": "^4.0",
        "twig/extensions": "^1.5",
        "uecode/qpush-bundle": "^3.0",
        "white-october/pagerfanta-bundle": "^1.2",
        "willdurand/js-translation-bundle": "^2.6",
        "xemlock/htmlpurifier-html5": "^0.1.7",
        "yproximite/common": "@dev",
        "yproximite/ekomi-api-bundle": "^3.0",
        "yproximite/influxdb-preset-bundle": "^2.0",
        "yproximite/performance-directe-wsdl-adapter": "^1.0",
        "yproximite/sendinblue-api": "^1.0",
        "yproximite/wanna-speak-bundle": "^4.0",
        "yproximite/yprox-api-client": "^0.10.1",
        "yproximite/yprox-api-client-bundle": "^2.1",
        "zohocrm/php-sdk": "^1.1"
    },
    "require-dev": {
        "behat-extension/doctrine-data-fixtures-extension": "^5.0",
        "behat/behat": "^3.4",
        "doctrine/doctrine-fixtures-bundle": "^3.0",
        "flow/jsonpath": "^0.4.0",
        "friends-of-behat/context-service-extension": "^1.2",
        "friends-of-behat/cross-container-extension": "^1.1",
        "friends-of-behat/symfony-extension": "^1.2",
        "friendsofphp/php-cs-fixer": "^2.12",
        "mockery/mockery": "^1.1",
        "nelmio/alice": "^3.4",
        "phpspec/phpspec": "^5.0",
        "phpstan/phpstan": "^0.10.2",
        "phpstan/phpstan-doctrine": "^0.10.0",
        "phpstan/phpstan-strict-rules": "^0.10.1",
        "phpstan/phpstan-symfony": "^0.10.0",
        "symfony/debug-pack": "^1.0",
        "symfony/dotenv": "*",
        "symfony/maker-bundle": "^1.5",
        "symfony/phpunit-bridge": "*",
        "symfony/profiler-pack": "^1.0",
        "webmozart/assert": "^1.3"
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "config": {
        "bin-dir": "bin",
        "platform": {
            "php": "7.2.4"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/",
            "Features\\": "features/bootstrap/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
            "security-checker security:check": "script"
        },
        "post-install-cmd": [
            "Fuz\\Symfony\\Collection\\ScriptHandler::postInstall",
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
        ],
        "post-update-cmd": [
            "Fuz\\Symfony\\Collection\\ScriptHandler::postUpdate",
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
        ]
    },
    "extra": {
        "symfony": {
            "allow-contrib": true,
            "require": "4.2.4"
        },
        "incenteev-parameters": {
            "file": "config/packages/parameters.yaml"
        }
    }
}

Output of composer diagnose:

Checking composer.json: WARNING
require.doctrine/doctrine-migrations-bundle : exact version constraints (v2.0.0-alpha1) should be avoided if the package follows semantic versioning
require.snc/redis-bundle : exact version constraints (3.x-dev) should be avoided if the package follows semantic versioning
require.symfony/asset : unbound version constraints (*) should be avoided
require.symfony/form : unbound version constraints (*) should be avoided
require.symfony/framework-bundle : unbound version constraints (*) should be avoided
require.symfony/lock : unbound version constraints (*) should be avoided
require.symfony/proxy-manager-bridge : unbound version constraints (*) should be avoided
require.symfony/security-bundle : unbound version constraints (*) should be avoided
require.symfony/translation : unbound version constraints (*) should be avoided
require.symfony/twig-bundle : unbound version constraints (*) should be avoided
require.symfony/validator : unbound version constraints (*) should be avoided
require.yproximite/common : unbound version constraints (@dev) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.8.4
PHP version: 7.2.4 - Package overridden via config.platform (actual: 7.3.3)
PHP binary path: /usr/bin/php7.3

When I run this command:

composer update

I get the following output:

Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "4.2.4"


  [ErrorException]
  Undefined index: extra

And I expected this to happen: Well I except a dependency update :p

I’m inside a Debian VM (Vagrant+VirtualBox). My local machine is on OSX 10.14.3

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (5 by maintainers)

Most upvoted comments

@Skape252 You could change this line in vendor/symfony/flex/src/Cache.php as in screenshot temporarily

from https://files.slack.com/files-pri/T38L468JV-F01C4754L1G/image.png image

to image

After that composer update should work. After package update, it should solve the problem and you don’t need to change this line again.

@denisp1993

there is discussion about it on drupal https://github.com/zaporylie/composer-drupal-optimizations/pull/22

still it is not composer/compser fault so not topic for this repo 😃

I am having the same problem today as well without custom forks

For me it happens in plugin I use - exactly in this line https://github.com/rubenrua/symfony-clean-tags-composer-plugin/blob/master/src/Cache.php#L61

so i guess it is not composer related… but still strange it started today.

I looks like some change done recently in symfony/symfony

We started to have same problem, but we don’t use custom symfony fork, or this drupal plugin. What helped in our case was

Index: composer.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- composer.json	(revision c0719fbceabff1d1acc856412a73b8588a930fcc)
+++ composer.json	(date 1601982579444)
@@ -157,8 +157,7 @@
         "symfony-tests-dir": "tests",
         "symfony-assets-install": "relative",
         "symfony": {
-            "allow-contrib": false,
-            "require": "4.3.*"
+            "allow-contrib": false
         }
     }
 }

I would like to know what is the trigger of this problem though, since this worked fine till now.

If your problem is with Drupal, a quick solution is to edit composer.lock to update zaporylie/composer-drupal-optimizations. the relevant sections below are version and reference to update.

            "name": "zaporylie/composer-drupal-optimizations",
            "version": "1.1.2",

and

            "source": {
                "type": "git",
                "url": "https://github.com/zaporylie/composer-drupal-optimizations.git",
                "reference": "0d6ebd8bc03679d312f99a1e4e950685dbf0ff18"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/zaporylie/composer-drupal-optimizations/zipball/0d6ebd8bc03679d312f99a1e4e950685dbf0ff18",
                "reference": "0d6ebd8bc03679d312f99a1e4e950685dbf0ff18",
                "shasum": ""
            },

then run composer install and composer update --lock

Or, you know, rm -rf vendor/zaporylie/composer-drupal-optimizations && composer update zaporylie/composer-drupal-optimizations is also quick.