Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sentry/src/SentryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function boot(): void
/* @phpstan-ignore-next-line */
Coroutine::afterCreated(function () {
$keys = [
Hub::CONTEXT_STACK_KEY => [],
Hub::CONTEXT_STACK_KEY => null,
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default value from [] to null will cause a TypeError in Hub::pushScope().

When Context::override() is called in Hub::pushScope() (line 61), it passes the current context value to a closure with type hint function (array $layers). If the context was initialized with null (as set by this change), the closure will receive null instead of an array, causing a type error: "Argument #1 must be of type array, null given".

The previous default value of [] ensured type compatibility with the closure in pushScope(). Consider reverting this change or update the closure in Hub::pushScope() to handle nullable arrays.

Suggested change
Hub::CONTEXT_STACK_KEY => null,
Hub::CONTEXT_STACK_KEY => [],

Copilot uses AI. Check for mistakes.
];
foreach ($keys as $key => $default) {
Context::set($key, Context::get($key, $default, Coroutine::parentId()));
Expand Down