Skip to content

Commit f83afbf

Browse files
committed
:octocat: validate mode in StreamUtil::tryFopen()
1 parent d2ad585 commit f83afbf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/StreamUtil.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@ public static function copyToStream(StreamInterface $source, StreamInterface $de
186186
* @throws \RuntimeException
187187
*/
188188
public static function tryFopen(string $filename, string $mode, $context = null){
189-
$exception = null;
190-
$message = 'Unable to open "%s" using mode "%s": %s';
189+
$mode = self::validateMode($mode);
190+
$exception = null;
191+
$message = 'Unable to open "%s" using mode "%s": %s';
191192

192193
$errorHandler = function(int $errno, string $errstr) use ($filename, $mode, &$exception, $message):bool{
193194
$exception = new RuntimeException(sprintf($message, $filename, $mode, $errstr));

0 commit comments

Comments
 (0)