diff --git a/src/Monolog/Handler/Slack/SlackRecord.php b/src/Monolog/Handler/Slack/SlackRecord.php index 8d8ca7ee..121dea11 100644 --- a/src/Monolog/Handler/Slack/SlackRecord.php +++ b/src/Monolog/Handler/Slack/SlackRecord.php @@ -96,7 +96,7 @@ class SlackRecord $this->includeContextAndExtra = $includeContextAndExtra; $this->formatter = $formatter; - if ($this->includeContextAndExtra && $this->useShortAttachment) { + if ($this->includeContextAndExtra) { $this->lineFormatter = new LineFormatter(); } } @@ -152,7 +152,7 @@ class SlackRecord foreach ($record['extra'] as $var => $val) { $attachment['fields'][] = array( 'title' => $var, - 'value' => $val, + 'value' => is_array($val) ? $this->lineFormatter->stringify($val) : $val, 'short' => $this->useShortAttachment, ); } @@ -171,7 +171,7 @@ class SlackRecord foreach ($record['context'] as $var => $val) { $attachment['fields'][] = array( 'title' => $var, - 'value' => $val, + 'value' => is_array($val) ? $this->lineFormatter->stringify($val) : $val, 'short' => $this->useShortAttachment, ); } diff --git a/tests/Monolog/Handler/Slack/SlackRecordTest.php b/tests/Monolog/Handler/Slack/SlackRecordTest.php index 2075df0f..1ef4121d 100644 --- a/tests/Monolog/Handler/Slack/SlackRecordTest.php +++ b/tests/Monolog/Handler/Slack/SlackRecordTest.php @@ -308,7 +308,7 @@ class SlackRecordTest extends TestCase ), array( 'title' => 'tags', - 'value' => array('web'), + 'value' => '["web"]', 'short' => false ), array(