Skip to content

Commit

Permalink
do not collect user data if session not started
Browse files Browse the repository at this point in the history
  • Loading branch information
asminog committed Apr 7, 2020
1 parent c3ada61 commit f35945d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/SentryTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private function convertLevel(int $level)
*/
private function setScopeUser()
{
if (Yii::$app->get('user', false) !== null and !empty($this->collectUserAttributes)) {
if (session_status() === PHP_SESSION_ACTIVE and Yii::$app->get('user', false) !== null and !empty($this->collectUserAttributes)) {
$attributes = ['id' => (Yii::$app->user ? Yii::$app->user->getId() : null)];
if (($user = Yii::$app->user->identity) !== null) {
foreach ($this->collectUserAttributes as $collectUserAttribute) {
Expand Down

0 comments on commit f35945d

Please sign in to comment.