Problem/Motivation

Error: Typed property Drupal\themespace\Plugin\Discovery\ProviderTypedAttributeClassDiscovery::$rootNsIterator must not be accessed before initialization in Drupal\themespace\Plugin\Discovery\ProviderTypedAttributeClassDiscovery->getPluginNamespaces() (line 194 of modules/contrib/themespace/src/Plugin/Discovery/ProviderTypedAttributeClassDiscovery.php).

Drupal\Component\Plugin\Discovery\AttributeClassDiscovery->__construct() (Line: 72)
Drupal\themespace\Plugin\Discovery\ProviderTypedAttributeClassDiscovery->__construct() (Line: 83)
Drupal\transmuter\Plugin\TransmuterManager->getDiscovery() (Line: 245)
Drupal\transmuter\Plugin\TransmuterManager->findTypedDefinitions() (Line: 99)
Drupal\transmuter\Plugin\TransmuterManager->findDefinitions() (Line: 216)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 280)
Drupal\transmuter\Plugin\TransmuterManager->groupPluginDefinitions() (Line: 304)
Drupal\transmuter\Plugin\TransmuterManager->getModuleDefinitions() (Line: 44)
Drupal\transmuter\ThemeRegistryBuilder->alterRegistry() (Line: 32)
transmuter_theme_registry_alter() (Line: 460)
Drupal\Core\Extension\ModuleHandler->alter() (Line: 491)
Drupal\Core\Theme\Registry->build() (Line: 326)
Drupal\Core\Theme\Registry->get() (Line: 90)
Drupal\Core\Utility\ThemeRegistry->initializeRegistry() (Line: 71)
Drupal\Core\Utility\ThemeRegistry->__construct() (Line: 368)
Drupal\Core\Theme\Registry->getRuntime() (Line: 139)
Drupal\Core\Theme\ThemeManager->render() (Line: 500)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 634)
Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
Fiber->resume() (Line: 649)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 235)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 131)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 50)
Drupal\ban\BanMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Also happens for `$nsSuffixes`.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork themespace-3565667

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

jasonsafro created an issue. See original summary.

jasonsafro’s picture

Status: Active » Needs review
lemming’s picture

Thank for the bug report.

Looks good generally.

The $nsSuffixes property is assigned in the constructor so it should be okay. But for clarity, maybe assign it an empty array instead of making it nullable. It should always be assumed to be an array.

lemming’s picture

Status: Needs review » Fixed

Created new release 3.0.0-beta2 which includes this fix and a couple other instances of property initializaiton.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

jasonsafro’s picture

Status: Fixed » Needs review

@lemming I'm not sure the constructor triggers properly when the class is "discovered". I was seeing an error with $nsSuffixes; I think it was the same error.

Regardless, thank you for getting this merged so quickly.

lemming’s picture

Assigned: jasonsafro » lemming
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.