Skip to content

Commit

Permalink
Add mode parameter to wrapSource
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed May 25, 2021
1 parent 93bce47 commit c492db9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/WrapperHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static function buildContext($protocol, $context, $source) {
* @param string|null $class deprecated, class is now automatically generated
* @return bool|resource
*/
protected static function wrapSource($source, $context = [], $protocol = null, $class = null) {
protected static function wrapSource($source, $context = [], $protocol = null, $class = null, $mode = 'r+') {
if ($class === null) {
$class = static::class;
}
Expand All @@ -72,7 +72,7 @@ protected static function wrapSource($source, $context = [], $protocol = null, $
if (self::isDirectoryHandle($source)) {
return opendir($protocol . '://', $context);
} else {
return fopen($protocol . '://', 'r+', false, $context);
return fopen($protocol . '://', $mode, false, $context);
}
} finally {
stream_wrapper_unregister($protocol);
Expand Down

0 comments on commit c492db9

Please sign in to comment.