Skip to content

Commit 3e28657

Browse files
committed
Check if stream_copy_to_stream fails.
1 parent 6856aa7 commit 3e28657

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Media/Process/Adapter/FfmpegShell.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ protected function _process() {
245245

246246
$target = fopen($targetTemp, 'r');
247247
$buffer = fopen('php://temp', 'w+');
248-
stream_copy_to_stream($target, $buffer);
248+
if (!stream_copy_to_stream($target, $buffer)) {
249+
throw new Exception('Failed to copy stream while processing ffmpeg source.');
250+
}
249251

250252
fclose($target);
251253
unlink($targetTemp);

src/Media/Process/Adapter/SoxShell.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ public function convert($mimeType) {
122122
// Workaround for header based formats which require the output stream to be seekable.
123123
$target = fopen($targetTemp, 'r');
124124
$buffer = fopen('php://temp', 'w+');
125-
stream_copy_to_stream($target, $buffer);
125+
if (!stream_copy_to_stream($target, $buffer)) {
126+
throw new Exception('Failed to copy stream while processing sox source.');
127+
}
126128

127129
fclose($target);
128130
unlink($targetTemp);

0 commit comments

Comments
 (0)