From a11bba23e4f3b342db9ca2358a258d4d3a783ff8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 30 May 2022 09:15:08 +0200 Subject: [PATCH] check if logger is set before using it --- inc/inc.ClassNotificationService.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index 7a323044c..b8da5e99d 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -93,13 +93,16 @@ class SeedDMS_NotificationService { if(!$service->toIndividual($sender, $recipient, $subject, $message, $params)) { $error = false; $this->errors[$name] = false; - $this->logger->log('Notification service \''.$name.'\': Sending notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') failed.', PEAR_LOG_ERR); + if($this->logger) + $this->logger->log('Notification service \''.$name.'\': Sending notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') failed.', PEAR_LOG_ERR); } else { - $this->logger->log('Notification service \''.$name.'\': Sending notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') successful (reason for notification: '.$recvtype.').', PEAR_LOG_INFO); + if($this->logger) + $this->logger->log('Notification service \''.$name.'\': Sending notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') successful (reason for notification: '.$recvtype.').', PEAR_LOG_INFO); $this->errors[$name] = true; } } else { - $this->logger->log('Notification service \''.$name.'\': Notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') filtered out (reason for notification: '.$recvtype.').', PEAR_LOG_INFO); + if($this->logger) + $this->logger->log('Notification service \''.$name.'\': Notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') filtered out (reason for notification: '.$recvtype.').', PEAR_LOG_INFO); } } return $error;