mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-04 00:54:08 +02:00
Better cleanup of registered streams
This commit is contained in:
parent
214a31bc98
commit
99ecfc5287
4 changed files with 26 additions and 7 deletions
|
|
@ -116,7 +116,12 @@ class IteratorDirectory implements Directory {
|
|||
throw new \BadMethodCallException('$source should be an Iterator or array');
|
||||
}
|
||||
stream_wrapper_register('iterator', '\Icewind\Streams\IteratorDirectory');
|
||||
$wrapped = opendir('iterator://', $context);
|
||||
try {
|
||||
$wrapped = opendir('iterator://', $context);
|
||||
} catch (\BadMethodCallException $e) {
|
||||
stream_wrapper_unregister('iterator');
|
||||
throw $e;
|
||||
}
|
||||
stream_wrapper_unregister('iterator');
|
||||
return $wrapped;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue