Service container aliases do not work

Created on 16 November 2016, about 8 years ago
Updated 8 November 2023, about 1 year ago

Problem/Motivation

Symfony's dependency injection container should allow you to shorthand aliases:

services:
  service1: '@service2'

This functionality is broken due to the rewrites in Drupal\Core\Component\DependencyInjection\YamlFileLoader::parseDefinitions() that add a 'provider' tag to a service definition.

Error: Cannot use string offset as an array in Drupal\Core\DependencyInjection\YamlFileLoader->parseDefinitions() (line 123 of core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php).

Proposed resolution

Verify that the service definition is an array definition, and not a shorthand alias, before attempting to add the 'provider' tag.

Remaining tasks

Patch attached to this issue.

User interface changes

N/A

API changes

N/A, however you are now able to use shorthand aliases in your container YAML's.

Data model changes

N/A

πŸ› Bug report
Status

Fixed

Version

9.1

Component
BaseΒ  β†’

Last updated 2 days ago

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024