Remove clearstatcache() call from LocalStream.

Created on 6 June 2015, over 9 years ago
Updated 17 February 2023, almost 2 years ago

Problem/Motivation

Drupal\Core\StreamWrapper\LocalStream::stream_metadata() calls clearstatcache(). This is somewhat helpful for people using stream wrappers, but it is inconsistent with how PHP's regular file handling works. This can lead to bugs where someone depends on the stream wrapper behavior, but then deals with a regular file.

Proposed resolution

Remove the clearstatcache() call.

Remaining tasks

Get consensus.

User interface changes

None.

API changes

Minor. Local stream wrappers now behave more like the regular file system.

๐Ÿ“Œ Task
Status

Needs work

Version

10.1 โœจ

Component
File systemย  โ†’

Last updated about 12 hours ago

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States twistor

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rassoni Bangalore

    Rashmisoni โ†’ made their first commit to this issueโ€™s fork.

  • @rashmisoni opened merge request.
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch
    +++ b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php
    @@ -243,37 +243,34 @@ public function stream_cast($cast_as) {
     
           case STREAM_META_ACCESS:
             $return = chmod($target, $value);
    +        if ($return) {
    +          // For convenience clear the file status cache of the underlying file,
    +          // since metadata operations are often followed by file status checks.
    +          clearstatcache(TRUE, $target);
    +          return TRUE;
    +        }
             break;
    

    The issue title and summary says remove the call, but this is moving it around - can we not remove it entirely?

Production build 0.71.5 2024