Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295813

AttributeClassDiscovery fails while trying to include non valid plugin class

$
0
0

Problem/Motivation

I noticed this issue when installing commerce_payment on the 11.x branch.
While discovering block plugin classes it tries to create a Reflection of the \Drupal\commerce_product\Plugin\Block\VariationFieldBlock.
VariationFieldBlock extends a FieldBlock class from the layout_builder module (which is not required for commerce_payment and in that case is not installed). While trying to create \ReflectionClass of it, the autoloader will start including that file and will fail due to FieldBlock not being included since layout_builder is not installed.
After that whole site will be down due to that critical error.

Steps to reproduce

  1. Clean install dev branch
  2. Install commerce_payment
  3. See "Unexpected error" on every page

Proposed resolution

Surrounding web/core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php:125 with try/catch seems to help, not sure if it is the right solution though.
I tried to add a test to \Drupal\Tests\Component\Plugin\Attribute\AttributeClassDiscoveryTest but to test this bug we need an autoloader, otherwise include_once will fail instantly.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 295813

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>