Problem/Motivation

Enabling Component on D9 will WSOD your site because the plugin discovery system will throw "Class does not exist" errors.

Steps to reproduce

Enable the Component module.

Proposed resolution

Update the namespace wherever it's referenced inside the module.

Issue fork component-3224956

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

msherron created an issue. See original summary.

rlnorthcutt’s picture

Status: Active » Fixed
rlnorthcutt’s picture

Status: Fixed » Closed (fixed)
japerry’s picture

This is incorrect. 'Component' is a namespace used by Drupal Core. #3294843: Error: Class "\Drupal\Component\ComponentDiscovery" not found reverts this issue.

For more information about best practices here, reference this: https://www.drupal.org/docs/develop/standards/psr-4-namespaces-and-autol...

Likely the original problem stems from an extra \ in front of the services yml, as well as the namespace of DeriverBase was not included properly until commit 37587c91

This module is on shaky ground with Drupal 8+ . It uses the same namespace, albeit lowercase, as core. little bugs that are simply 'nits' in other modules are going to cause some pretty catastrophic failures with this module if not caught.

japerry’s picture

avpaderno’s picture

This module is on shaky ground with Drupal 8+ . It uses the same namespace, albeit lowercase, as core. little bugs that are simply 'nits' in other modules are going to cause some pretty catastrophic failures with this module if not caught.

It's probably better to create a new project with a better machine name, change all the code to use the new machine name in namespaces, and commit the code in the new project repository.