Skip to content

Commit

Permalink
Handle empty log array while preparing data to display (#214)
Browse files Browse the repository at this point in the history
PHP 7.4 throws an error while trying to access array offset on value
of type bool returned by reset() method for empty log
  • Loading branch information
RaazPuspa authored and rap2hpoutre committed Dec 3, 2019
1 parent 5957eb0 commit 031ed45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/controllers/LogViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function index()
return $data;
}

if (is_array($data['logs'])) {
if (is_array($data['logs']) && count($data['logs']) > 0) {
$firstLog = reset($data['logs']);
if (!$firstLog['context'] && !$firstLog['level']) {
$data['standardFormat'] = false;
Expand Down

0 comments on commit 031ed45

Please sign in to comment.