`FileSystem->prepareDirectory` doesn't handle stream wrappers that require arguments

Created on 6 February 2025, 2 months ago

Problem/Motivation

`FileSystem->prepareDirectory` method doesn't handle stream wrappers that require arguments in the constructor. If the directory path is supposed to be handled by such a wrapper, the exception `ArgumentCountError: Too few arguments to function` will occur because arguments will not be passed to the constructor.

This is because `prepareDirectory` doesn't depend on a stream wrapper service for what it's doing, it just invokes core PHP functions that instantiate wrapper themselves, but they lack the ability to pass arguments to the constructor of such an instance.

See: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co...

Steps to reproduce

  1. Create a custom stream wrapper with arguments.
  2. Try to use `FileSystem->prepareDirectory` on such a stream.

Proposed resolution

I don't have a solution yet, but I'll be thinking about it. For now, I just wanted to report the issue.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.1 🔥

Component

file system

Created by

🇵🇱Poland Luke_Nuke

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

Comments & Activities

Production build 0.71.5 2024