Skip to content

Commit

Permalink
file_get_contents() may fail, in which case it returns false
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 30, 2020
1 parent 37d02f0 commit f57379c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Runner/PhptTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,14 @@ private function renderForCoverage(string &$job): void

private function cleanupForCoverage(): array
{
$files = $this->getCoverageFiles();
$coverage = @\unserialize(\file_get_contents($files['coverage']));
$files = $this->getCoverageFiles();
$buffer = \file_get_contents($files['coverage']);

if ($buffer === false) {
$coverage = [];
} else {
$coverage = @\unserialize($buffer);
}

if ($coverage === false) {
$coverage = [];
Expand Down

0 comments on commit f57379c

Please sign in to comment.