From 2d1fbbe4232a5070f1b60b33a238a614a4a3b385 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Mon, 14 Nov 2016 23:19:45 +0200 Subject: [PATCH] Make SlackRecord::stringify() work without a line formatter --- src/Monolog/Handler/Slack/SlackRecord.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Monolog/Handler/Slack/SlackRecord.php b/src/Monolog/Handler/Slack/SlackRecord.php index cc8493c1..4b370b3b 100644 --- a/src/Monolog/Handler/Slack/SlackRecord.php +++ b/src/Monolog/Handler/Slack/SlackRecord.php @@ -216,10 +216,14 @@ class SlackRecord * Stringifies an array of key/value pairs to be used in attachment fields * * @param array $fields - * @return string + * @return string|null */ public function stringify($fields) { + if (!$this->lineFormatter) { + return null; + } + $string = ''; foreach ($fields as $var => $val) { $string .= $var.': '.$this->lineFormatter->stringify($val)." | ";