function LocalReadOnlyStream::stream_open

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php \Drupal\Core\StreamWrapper\LocalReadOnlyStream::stream_open()
  2. 10 core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php \Drupal\Core\StreamWrapper\LocalReadOnlyStream::stream_open()
  3. 11.x core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php \Drupal\Core\StreamWrapper\LocalReadOnlyStream::stream_open()

Overrides LocalStream::stream_open

File

core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php, line 28

Class

LocalReadOnlyStream
Defines a read-only Drupal stream wrapper base class for local files.

Namespace

Drupal\Core\StreamWrapper

Code

public function stream_open($uri, $mode, $options, &$opened_path) {
    if (!in_array($mode, [
        'r',
        'rb',
        'rt',
    ])) {
        if ($options & STREAM_REPORT_ERRORS) {
            trigger_error('stream_open() write modes not supported for read-only stream wrappers', E_USER_WARNING);
        }
        return FALSE;
    }
    return parent::stream_open($uri, $mode, $options, $opened_path);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.