InvalidArgumentException: "Class "\Drupal\environment_indicator\Form\EnvironmentIndicatorSettingsForm" does not exist."

Created on 6 April 2023, about 2 years ago

Problem/Motivation

Uncaught PHP Exception InvalidArgumentException: "Class "\Drupal\environment_indicator\Form\EnvironmentIndicatorSettingsForm" does not exist." at ...\web\core\lib\Drupal\Core\DependencyInjection\ClassResolver.php line 24

Watchdog message: InvalidArgumentException: Class "\Drupal\environment_indicator\Form\EnvironmentIndicatorSettingsForm" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 24 of ...\web\core\lib\Drupal\Core\DependencyInjection\ClassResolver.php).

  • Drupal 10.0.7
  • PHP 8.1.13
  • MySQL 8.0.32
  • Apache 2.4.46

Steps to reproduce

Install the module, enable, and then attempt to access the configuration page. White screen of death, and the above message in the log.

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada sdsheridan Toronto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sdsheridan
  • πŸ‡¨πŸ‡¦Canada sdsheridan Toronto

    OK, just realised that the documentation needs to be updated for this to not happen. The settings.php (or settings.local.php) adjustments must be made first, and for D10, the variable is $settings, not $config. That said, it probably shouldn't catastrophically fail if those changes are not yet made, but rather should show instructions to that effect on the configuration page.

    Also, not seeing any changes now despite being able to access the configuration page. Will open separate issue for that.

  • πŸ‡¨πŸ‡¦Canada sdsheridan Toronto
  • Status changed to Closed: cannot reproduce about 14 hours ago
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    I am unable to reproduce this error, here is my Lando setup. Feel free to reopen if you disagree.

    name: environment_indicator
    recipe: drupal10
    config:
      php: '8.1'
      via: apache:2.4
      webroot: web
      database: mariadb:10.6
      xdebug: false
    services:
      database:
        type: compose
        services:
          image: mariadb:10.6
          command: docker-entrypoint.sh mariadbd
          restart: always
          ports:
            - '3306'
          environment:
            MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 'true'
            MARIADB_DATABASE: drupal10
            MYSQL_DATABASE: drupal10
            MARIADB_USER: drupal10
            MARIADB_PASSWORD: drupal10
      appserver:
        overrides:
          environment:
            SIMPLETEST_DB: 'mysql://drupal10:drupal10@database/drupal10'
            SIMPLETEST_BASE_URL: 'http://appserver'
          volumes:
            # Don't share our host working directory as /app. We want /app empty for composer.
            - /app
            # Instead share our host working directory as a standalone package.
            - .:/usr/local/environment_indicator
        build:
          # Create a new Drupal project and use the module as a non-packagist repository.
          - composer create-project --dev drupal/recommended-project:10.0.x /app
          - composer config extra.enable-patching true
          - composer config extra.composer-exit-on-patch-failure true
          - composer config allow-plugins.cweagans/composer-patches true
          - composer require cweagans/composer-patches
          - composer config minimum-stability dev
          - composer config allow-plugins.phpstan/extension-installer true
          - composer require --dev drupal/core-dev:^10.0 drush/drush phpspec/prophecy-phpunit:* phpstan/extension-installer mglaman/phpstan-drupal phpstan/phpstan-deprecation-rules drupal/config_inspector drupal/devel
          - composer config repositories.localdev path /usr/local/environment_indicator && composer require drupal/environment_indicator:\*@dev
      node:
        type: node:20
        build:
          - yarn install
      chromedriver:
        type: compose
        services:
          image: seleniarm/standalone-chromium:4.1.4-20220429
          command: /opt/bin/entry_point.sh
    tooling:
      # Provide a command to install Drupal.
      install:
        service: appserver
        cmd:
          - /app/vendor/bin/drush --root=/app/web site:install --account-mail=noreply@example.com --account-name=admin --account-pass=admin --db-url=mysql://drupal10:drupal10@database:3306/drupal10 -y --verbose
          - /app/vendor/bin/drush --root=/app/web en -y environment_indicator environment_indicator_ui devel config_inspector
          - /app/vendor/bin/drush --root=/app/web uli -l https://environmentindicator.lndo.site/
      # Provide Drush tooling to automatically know the Drupal root.
      drush:
        service: appserver
        cmd: /app/vendor/bin/drush --root=/app/web
      phpcs:
        service: appserver
        cmd: /app/vendor/bin/phpcs -s --colors --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/environment_indicator
      # Provide PHPCBF tooling to fix coding standards.
      phpcbf:
        service: appserver
        cmd: /app/vendor/bin/phpcbf -s --colors --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/environment_indicator
      # Provide phpstan tooling to check for code quality and deprecated code.
      phpstan:
        service: appserver
        cmd: /app/vendor/bin/phpstan analyse --configuration web/modules/contrib/environment_indicator/phpstan.neon web/modules/contrib/environment_indicator
      # Provide phpunit tooling to run unit tests.
      phpunit:
        service: appserver
        cmd: /app/vendor/bin/phpunit --configuration /app/web/core/phpunit.xml.dist --bootstrap /app/web/core/tests/bootstrap.php /app/web/modules/contrib/environment_indicator
      yarn:
        service: node
        cmd: yarn
      eslint:
        service: node
        cmd: yarn run eslint --color
    
Production build 0.71.5 2024