Skip to content

Commit

Permalink
FIX Handle invalid json data
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jan 24, 2023
1 parent ffe1bc8 commit fe5e875
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/TestSessionEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,10 @@ public function resetDatabaseName()
public function getState()
{
$path = Director::getAbsFile($this->getFilePath());
return (file_exists($path ?? '')) ? json_decode(file_get_contents($path)) : new stdClass;
if (file_exists($path ?? '')) {
return json_decode(file_get_contents($path)) ?: new stdClass;
}
return new stdClass;
}

/**
Expand Down

0 comments on commit fe5e875

Please sign in to comment.