Skip to content

feat(scopes): add clients to scopes#2114

Open
Litarnus wants to merge 2 commits into
new-scopes-lightfrom
scopes-client
Open

feat(scopes): add clients to scopes#2114
Litarnus wants to merge 2 commits into
new-scopes-lightfrom
scopes-client

Conversation

@Litarnus

Copy link
Copy Markdown
Contributor

No description provided.

@Litarnus Litarnus marked this pull request as ready for review June 22, 2026 14:38

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c86807c. Configure here.

Comment thread src/State/Scope.php
return $mergedScope;
}

/**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

mergeScopes drops global client

High Severity

Scope::mergeScopes clones the isolation scope and merges tags and other fields, but keeps the isolation scope’s bound client unchanged. After a normal init($client), the global scope holds the real client while the isolation scope still has a default NoOpClient, so a merged capture scope reports a no-op client even though SentrySdk::getClient() would return the global client.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c86807c. Configure here.

Comment thread src/SentrySdk.php
$hubClient = $client ?? new NoOpClient();

if ($client !== null) {
self::getGlobalScope()->setClient($client);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-init leaves stale global client

Medium Severity

Calling SentrySdk::init() without a client creates a hub with NoOpClient but does not update the process-global scope’s client when one was set by an earlier init($client). SentrySdk::getClient() then keeps returning the previous real client while the current hub uses a no-op client.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c86807c. Configure here.

Comment thread src/SentrySdk.php
return $client;
}

return self::getGlobalScope()->getClient();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bindClient ignores global scope

Medium Severity

Hub::bindClient updates only the hub stack layer. It does not update the process-global scope client, while SentrySdk::getClient() resolves the client from isolation and global scopes. After SentrySdk::init()->bindClient($client), the hub sends with the bound client but SentrySdk::getClient() still returns the global scope’s default NoOpClient.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c86807c. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c86807c. Configure here.

Comment thread src/State/Scope.php
return $mergedScope;
}

/**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

mergeScopes drops global client

High Severity

Scope::mergeScopes clones the isolation scope and merges tags and other fields, but keeps the isolation scope’s bound client unchanged. After a normal init($client), the global scope holds the real client while the isolation scope still has a default NoOpClient, so a merged capture scope reports a no-op client even though SentrySdk::getClient() would return the global client.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c86807c. Configure here.

Comment thread src/SentrySdk.php
$hubClient = $client ?? new NoOpClient();

if ($client !== null) {
self::getGlobalScope()->setClient($client);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-init leaves stale global client

Medium Severity

Calling SentrySdk::init() without a client creates a hub with NoOpClient but does not update the process-global scope’s client when one was set by an earlier init($client). SentrySdk::getClient() then keeps returning the previous real client while the current hub uses a no-op client.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c86807c. Configure here.

Comment thread src/SentrySdk.php
return $client;
}

return self::getGlobalScope()->getClient();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bindClient ignores global scope

Medium Severity

Hub::bindClient updates only the hub stack layer. It does not update the process-global scope client, while SentrySdk::getClient() resolves the client from isolation and global scopes. After SentrySdk::init()->bindClient($client), the hub sends with the bound client but SentrySdk::getClient() still returns the global scope’s default NoOpClient.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c86807c. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant