development.services.yml should document that parameters are only shallow-merged

Created on 5 March 2024, 10 months ago
Updated 5 June 2024, 7 months ago

Problem/Motivation

development.services.yml allows the developer to override container parameters for debugging. However, \Drupal\Core\DependencyInjection\YamlFileLoader only does a shallow merge of these.

So for example, setting this to enable render cache debug output will crash the site:

parameters:
  renderer.config:
    debug: true

because the renderer requires the required_cache_contexts.

This means that if you want to override only one key in a parameter, you have to specify the defaults for the others, thus:

  renderer.config:
    required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
    auto_placeholder_conditions:
      max-age: 0
      contexts: ['session', 'user']
      tags: []
    debug: true # This is the only value I am overriding.

This should be documented in development.services.yml.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

10.3 ✨

Component
DocumentationΒ  β†’

Last updated 13 minutes ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024