Use require instead of include_once on settings.php files

Created on 1 March 2023, almost 2 years ago
Updated 20 March 2023, almost 2 years ago

Problem/Motivation

Drupal stores the settings a the service called settings, with class Drupal\Core\Site\Settings.
During the profile installation via drush, as the settings.php is included in a very early bootstrap stage, the settings are being initialized 2 times:

* The first time happens when the the site-install drush command runs.
* The second time is when you confirm you want to install the site (when you answer "yes" in the prompt).

Since we are running the command with drush, everything is running on the same php thread. As consequence the second time the include_once is not being executed a second time, so the settings are not being included. This can trigger undesired side-effects. For example I found the issue when trying to install a site from existing config, because the $settings['config_sync_directory'] didn't exist, but there can be many other issues.

Steps to reproduce

Proposed resolution

Replace include by require

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

10.0

Component

Code

Created by

🇪🇸Spain akalam

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.

Production build 0.71.5 2024