Skip to content

Commit cf2498a

Browse files
Rafagdsebastianbergmann
authored andcommitted
Avoiding reading from STDOUT when rewind fails
1 parent c6b89b6 commit cf2498a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Framework/TestRunner/templates/class.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ function __phpunit_run_isolated_test()
8787
ini_set('xdebug.scream', '0');
8888

8989
// Not every STDOUT target stream is rewindable
90-
@rewind(STDOUT);
90+
$hasRewound = @rewind(STDOUT);
9191

92-
if ($stdout = @stream_get_contents(STDOUT)) {
92+
if ($hasRewound && $stdout = @stream_get_contents(STDOUT)) {
9393
$output = $stdout . $output;
9494
$streamMetaData = stream_get_meta_data(STDOUT);
9595

src/Framework/TestRunner/templates/method.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ function __phpunit_run_isolated_test()
8787
ini_set('xdebug.scream', '0');
8888

8989
// Not every STDOUT target stream is rewindable
90-
@rewind(STDOUT);
90+
$hasRewound = @rewind(STDOUT);
9191

92-
if ($stdout = @stream_get_contents(STDOUT)) {
92+
if ($hasRewound && $stdout = @stream_get_contents(STDOUT)) {
9393
$output = $stdout . $output;
9494
$streamMetaData = stream_get_meta_data(STDOUT);
9595

0 commit comments

Comments
 (0)