Skip to content

Commit

Permalink
Merge pull request #20 from chemezov/chemezov-patch-1
Browse files Browse the repository at this point in the history
fixed Undefined property and Undefined index errors
  • Loading branch information
nadar authored Dec 16, 2021
2 parents 3037af7 + 89ddb47 commit af20b63
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
In order to read more about upgrading and BC breaks have a look at the [UPGRADE Document](UPGRADE.md).

## 2.2.3 (?)

+ Fixed Data::getTrace() PHP Notice: Undefined index: class.
+ Fixed SentryAdapter::generateContext() method. When OS or Browser version is not detected, an exception was thrown (Undefined property).

## 2.2.2 (9. December 2021)

+ Slack token docs
Expand Down
8 changes: 4 additions & 4 deletions src/adapters/SentryAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ public function generateContext(Data $data)
if ($data->getWhichBrowser()) {
// os
$contexts['os'] = [
'version' => $data->getWhichBrowser()->os->version->value,
'name' => $data->getWhichBrowser()->os->name,
'version' => isset($data->getWhichBrowser()->os->version->value) ? $data->getWhichBrowser()->os->version->value : null,
'name' => isset($data->getWhichBrowser()->os->name) ? $data->getWhichBrowser()->os->name : null,
'type' => 'os',
];
// browser
$contexts['browser'] = [
'version' => $data->getWhichBrowser()->browser->version->value,
'name' => $data->getWhichBrowser()->browser->name,
'version' => isset($data->getWhichBrowser()->browser->version->value) ? $data->getWhichBrowser()->browser->version->value : null,
'name' => isset($data->getWhichBrowser()->browser->name) ? $data->getWhichBrowser()->browser->name : null,
'type' => 'browser',
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public function getTrace()
'file' => $content['file'],
'line' => $content['line'],
'function' => $content['function'],
'class' => $content['class'],
'class' => isset($content['class']) ? $content['class'] : null,
'context_line' => isset($content['context_line']) ? $content['context_line'] : null,
'pre_context' => isset($content['pre_context']) ? $content['pre_context'] : null,
'post_context' => isset($content['post_context']) ? $content['post_context'] : null,
Expand Down

0 comments on commit af20b63

Please sign in to comment.