Skip to content

Commit f7ff2d7

Browse files
committed
fix: guard against corner case where return value is a string
1 parent 439bfa6 commit f7ff2d7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Instrumentation/PDO/src/PDOInstrumentation.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ public static function register(): void
7070

7171
$dsn = $params[0] ?? '';
7272

73-
$attributes = $pdoTracker->trackPdoAttributes($object, $dsn);
74-
$span->setAttributes($attributes);
73+
// guard against PDO::connect returning a string
74+
if ($result instanceof PDO) {
75+
$attributes = $pdoTracker->trackPdoAttributes($result, $dsn);
76+
$span->setAttributes($attributes);
77+
}
7578

7679
self::end($exception);
7780
}

0 commit comments

Comments
 (0)