function PharStreamWrapper::stream_open

Parameters

string $path:

string $mode:

int $options:

string|null $opened_path:

Return value

bool

File

misc/typo3/phar-stream-wrapper/src/PharStreamWrapper.php, line 237

Class

PharStreamWrapper

Namespace

TYPO3\PharStreamWrapper

Code

public function stream_open($path, $mode, $options, &$opened_path = null) {
    $this->assert($path, Behavior::COMMAND_STREAM_OPEN);
    $arguments = array(
        $path,
        $mode,
        (bool) ($options & STREAM_USE_PATH),
    );
    // only add stream context for non include/require calls
    if (!($options & static::STREAM_OPEN_FOR_INCLUDE)) {
        $arguments[] = $this->context;
        // work around https://bugs.php.net/bug.php?id=66569
        // for including files from Phar stream with OPcache enabled
    }
    else {
        Helper::resetOpCache();
    }
    $this->internalResource = call_user_func_array(array(
        $this,
        'invokeInternalStreamWrapper',
    ), array_merge(array(
        'fopen',
    ), $arguments));
    if (!is_resource($this->internalResource)) {
        return false;
    }
    if ($opened_path !== null) {
        $metaData = stream_get_meta_data($this->internalResource);
        $opened_path = $metaData['uri'];
    }
    return true;
}

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