function LocalStream::stream_open

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

Overrides PhpStreamWrapperInterface::stream_open

1 call to LocalStream::stream_open()
LocalReadOnlyStream::stream_open in core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
Opens file or URL.
1 method overrides LocalStream::stream_open()
LocalReadOnlyStream::stream_open in core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
Opens file or URL.

File

core/lib/Drupal/Core/StreamWrapper/LocalStream.php, line 147

Class

LocalStream
Defines a Drupal stream wrapper base class for local files.

Namespace

Drupal\Core\StreamWrapper

Code

public function stream_open($uri, $mode, $options, &$opened_path) {
    $this->uri = $uri;
    $path = $this->getLocalPath();
    if ($path === FALSE) {
        if ($options & STREAM_REPORT_ERRORS) {
            trigger_error('stream_open() filename cannot be empty', E_USER_WARNING);
        }
        return FALSE;
    }
    $this->handle = $options & STREAM_REPORT_ERRORS ? fopen($path, $mode) : @fopen($path, $mode);
    if ((bool) $this->handle && $options & STREAM_USE_PATH) {
        $opened_path = $path;
    }
    return (bool) $this->handle;
}

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