Skip to content

Commit

Permalink
Avoid passing null to fwrite in the LoggerAppenderConsole
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacysokolowski committed Nov 1, 2023
1 parent 814634a commit 3622ab0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/php/appenders/LoggerAppenderConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class LoggerAppenderConsole extends LoggerAppender {
public function activateOptions() {
$this->fp = fopen($this->target, 'w');
if(is_resource($this->fp) && $this->layout !== null) {
fwrite($this->fp, $this->layout->getHeader());
fwrite($this->fp, $this->layout->getHeader() ?? "");
}
$this->closed = (bool)is_resource($this->fp) === false;
}
Expand All @@ -64,7 +64,7 @@ public function activateOptions() {
public function close() {
if($this->closed != true) {
if (is_resource($this->fp) && $this->layout !== null) {
fwrite($this->fp, $this->layout->getFooter());
fwrite($this->fp, $this->layout->getFooter() ?? "");
fclose($this->fp);
}
$this->closed = true;
Expand Down

0 comments on commit 3622ab0

Please sign in to comment.