Bug #34555

StreamWrapperAdapter::stream_lock does not return StreamWrapper result

Added by Bastian Waidelich over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Should have
Category:
Resource
Start date:
2012-03-06
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

While writing unit tests for the StreamWrapperAdapter, I came upon this issue: StreamWrapperAdapter::stream_lock() does not return the results of the actual stream wrapper. But according to the docs this "returns TRUE on success or FALSE on failure.".

Apart from that the StreamWrapperAdapter is lacking unit tests currently

Most of the functions in StreamWrapperAdapter call createStreamWrapper() in order to retrieve the actual StreamWrapper. The method looks like this:

protected function createStreamWrapper($path) {
    if ($this->streamWrapper === NULL) {
        $explodedPath = explode(':', $path, 2);
        $scheme = array_shift($explodedPath);
        $this->streamWrapper = self::$objectManager->create(self::$registeredStreamWrappers[$scheme]);
    }
}

If I get it right, this means that the streamWrapper is only instantiated the first time this method is called. createStreamWrapper('sheme1://foo'); createStreamWrapper('sheme2://bar'); would return the same instance.

NOTE: As Karsten mentioned in the comments, this is probably not true as PHP will create a fresh instance of the adapter for every use. But this should be secured with tests (also to prevent issues like #34547)


Related issues

Related to TYPO3.Flow - Bug #34547: wrong variable name inside rename() of StreamWrapperAdapterResolvedBernhard Fischer2012-03-06

Actions

Also available in: Atom PDF