Problem/Motivation

Five backward-compatibility fallbacks on 11.x call \Drupal::service() with an ID that does not exist. A caller that omits the new constructor argument gets a ServiceNotFoundException instead of the deprecation notice.

  • LibraryDiscoveryParser::__construct() requests libraries.parsing_cache instead of library.parsing_cache.
  • YamlRouteDiscovery::__construct() requests routing.yaml_cache_collector instead of router.yaml_cache_collector. Its $yamlCacheCollector argument also has no default value, so omitting it throws an ArgumentCountError before the fallback runs.
  • ResourceObjectNormalizer::__construct() requests entity_field_manager and entity_type_manager instead of entity_field.manager and entity_type.manager.
  • WorkspaceAssociation::__construct() requests workspace.tracker instead of workspaces.tracker.

The main branch has already removed these fallbacks, so only 11.x is affected.

Steps to reproduce

In a kernel test with the workspaces module enabled, run new WorkspaceAssociation(NULL);. It throws:

You have requested a non-existent service "workspace.tracker".

Constructing the other three classes without the deprecated argument fails the same way.

Proposed resolution

Use the correct service IDs, and give $yamlCacheCollector in YamlRouteDiscovery a NULL default.

I used AI assistance (Claude) to prepare this issue and the merge request, and I checked the result.

Issue fork drupal-3636525

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

giuseppe87 created an issue. See original summary.

giuseppe87 changed the visibility of the branch 3636525-five-constructor-deprecation to hidden.

giuseppe87’s picture

Status: Active » Needs review
giuseppe87’s picture

Issue summary: View changes
giuseppe87’s picture

Version: main » 11.5.x-dev