Active
Project:
Drupal core
Version:
main
Component:
file system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
29 Sep 2021 at 12:05 UTC
Updated:
7 Jun 2024 at 12:59 UTC
Jump to comment: Most recent
The \Drupal\Core\StreamWrapper\PrivateStream::getDirectoryPath() could get NULL from basepath() method as #3239761: Fix MimeTypeTest to prevent deprecations in PHP 8.1 and fix \Drupal\Core\StreamWrapper\PrivateStream::basePath() documentation documents
throw exception to prevent access to / (root file system) when accessing non configured private files
review, patch, commit
tbd
tbd
no
tbd
Comments
Comment #2
alexpottIn \Drupal\Core\CoreServiceProvider::register() we do...
Therefore the code that relies on \Drupal\Core\StreamWrapper\PrivateStream::getDirectoryPath() reasonably expected this to return a string. If the private stream wrapper is incorrectly registered prior to the file_private_path being set we should throw a logic exception since it is just not supposed to work this way.
Also we could consider changing
Settings::get('file_private_path')to\Drupal\Core\StreamWrapper\PrivateStream::basePath()Settings::get('file_public_path')to\Drupal\Core\StreamWrapper\PublicStream::basePath()We could save some duplicated code in system_requirements() and have less hard-coded strings lying about.
Comment #3
andypostThank for great idea, just checked usage and it's clear that
file_private_pathexpected as empty string by defaultComment #4
alexpott@andypost well that's commented out - so by default it is not set :) i.e NULL. And it is not set by the installer.
Comment #9
andypost