Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
(bugfix): Protect LogIterator.php from empty array indices
Add test to verify $entry['time'] is set prior to using it.

Works around #352

Signed-off-by: Matt <[email protected]>
  • Loading branch information
fsbruva committed Aug 3, 2020
commit ce26d1db6449d32554f8ff52e9ee7cfaedf7e483
8 changes: 5 additions & 3 deletions lib/Log/LogIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ function rewind() {
function current() {
$entry = json_decode($this->lastLine, true);
if ($this->dateFormat !== \DateTime::ATOM) {
$time = \DateTime::createFromFormat($this->dateFormat, $entry['time'], $this->timezone);
if ($time) {
$entry['time'] = $time->format(\DateTime::ATOM);
if (isset($entry['time'])) {
$time = \DateTime::createFromFormat($this->dateFormat, $entry['time'], $this->timezone);
if ($time) {
$entry['time'] = $time->format(\DateTime::ATOM);
}
}
}
return $entry;
Expand Down