Skip to content

Commit 9f1e669

Browse files
AidasKstayallive
andauthored
Fix TypeError in SentryHandler when passing non-string tags through log channels (#507)
Co-authored-by: Alex Bouma <[email protected]>
1 parent fcc6296 commit 9f1e669

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Update phpdoc on facade for better IDE autocompletion (#504)
66
- Exceptions captured using log channels (Monolog) will now have the correct severity set (#505)
7+
- Tags passed through log channels (Monolog) context are cast as string to prevent type errors (#507)
78

89
## 2.7.0
910

src/Sentry/Laravel/SentryHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ function (Scope $scope) use ($record, $isException, $exception) {
189189

190190
if (!empty($record['context']['tags'])) {
191191
foreach ($record['context']['tags'] as $key => $tag) {
192-
$scope->setTag($key, $tag);
192+
$scope->setTag($key, (string)$tag);
193193
}
194194
unset($record['context']['tags']);
195195
}
@@ -206,7 +206,7 @@ function (Scope $scope) use ($record, $isException, $exception) {
206206
}
207207

208208
if (!empty($record['context']['user'])) {
209-
$scope->setUser((array)$record['context']['user'], true);
209+
$scope->setUser((array)$record['context']['user']);
210210
unset($record['context']['user']);
211211
}
212212

0 commit comments

Comments
 (0)