Remove clearstatcache() call from LocalStream.

Created on 6 June 2015, over 9 years ago
Updated 17 February 2023, over 1 year 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 1 day 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.

  • First commit to issue fork.
  • @rashmisoni opened merge request.
  • Status changed to Needs work over 1 year 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