Add mode parameter to wrapSource

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2021-05-25 09:14:38 +02:00
commit c492db92a2
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF

View file

@ -57,7 +57,7 @@ class WrapperHandler {
* @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;
}
@ -72,7 +72,7 @@ class WrapperHandler {
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);