Skip to content

Commit

Permalink
Merge pull request #562 from rollbar/fixed_134
Browse files Browse the repository at this point in the history
Fixed Person ID not cast to string
  • Loading branch information
danielmorell committed Mar 30, 2022
2 parents d2fde4e + 3711aaf commit 0d11475
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
42 changes: 41 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.2] - 2022-03-30
This release is a patch to fix a regression in functionality that was introduced
in v3.0.0.
### Fixed
* Fixed https://github.com/rollbar/rollbar-php-laravel/issues/134 Person ID not
cast to string by @danielmorell in #562

## [3.1.1] - 2022-03-11
This release is a patch to fix a bug in the TraceChain class that was introduced
in v3.1.0.
### Fixed
* Tracechain must implements ContentInterface to be part of Body. by @stephpy
in #560

## [3.1.0] - 2022-03-09
Aside from some needed maintenance and bug fixes, this release resolves some
issues needed to support PHP 8.1. It also updates our support for `psr/log` to
v2! The other significant update is the addition of the `transformer` option.

One of the important changes is in what types can be passed to `custom` argument
in `Rollbar\Rollbar::init()`. Passing in an object or class instance that does
not implement the new `Rollbar\SerializerInterface` has been deprecated. This
helps us ensure any custom values in your payload are serializable, and they can
be sent to Rollbar serves without error.
### Added
- Added transformer option by @danielroehrig in #543
- Allow `psr/log` v2 by @Jean85 in #536
- Added psalm static analysis by @bishopb in #550, and #551
- Added `Rollbar\SerializerInterface` to describe serialization behavior @danielmorell in #558
### Fixed
- Fixed `report_suppressed` isset check by @trsteel88 and @bishopb in #539, and $546.
- Fixed missed cleanup of synthetic member variable by @bishopb in #547
- Fixed possibly null argument by @bishopb in #552
- Fixed deprecation warnings on PHP 8.1 @danielmorell in #558
### Changed
* Update PR template by @bxsx in #549

## [3.0.0] - 2021-06-28
### Changed
- The new configuration option `scrub_safelist` replaces the deprecated
Expand Down Expand Up @@ -550,7 +587,10 @@ however this is for convenience only and the methods that have changed have been
- Error handler function (`report_php_error`) now always returns false, so that the default php error handler still runs. This is a breaking change if your code relied on the old behavior where the error handler did *not* ever halt script execution.


[Unreleased]: https://github.com/rollbar/rollbar-php/compare/v3.0.0...HEAD
[Unreleased]: https://github.com/rollbar/rollbar-php/compare/v3.1.2...HEAD
[3.1.2]: https://github.com/rollbar/rollbar-php/compare/v3.1.1...v3.1.2
[3.1.1]: https://github.com/rollbar/rollbar-php/compare/v3.1.0...v3.1.1
[3.1.0]: https://github.com/rollbar/rollbar-php/compare/v3.0.0...v3.1.0
[3.0.0]: https://github.com/rollbar/rollbar-php/compare/v3.0.0-RC2...v3.0.0
[3.0.0-RC2]: https://github.com/rollbar/rollbar-php/compare/v3.0.0-RC1...v3.0.0-RC2
[3.0.0-RC1]: https://github.com/rollbar/rollbar-php/compare/v2.1.0...v3.0.0-RC1
Expand Down
2 changes: 1 addition & 1 deletion src/DataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ protected function getPerson()
return null;
}

$identifier = $personData['id'];
$identifier = (string)$personData['id'];

$email = null;
if ($this->captureEmail && isset($personData['email'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Payload/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Notifier implements SerializerInterface
{
const NAME = "rollbar-php";
const VERSION = "3.0.0";
const VERSION = "3.1.2";

use UtilitiesTrait;

Expand Down
21 changes: 20 additions & 1 deletion tests/DataBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,25 @@ public function testPersonFunc()
$output = $dataBuilder->makeData(Level::ERROR, "testing", array());
$this->assertEquals('123', $output->getPerson()->getId());
}

public function testPersonIntID()
{
$dataBuilder = new DataBuilder(array(
'accessToken' => $this->getTestAccessToken(),
'environment' => 'tests',
'person' => array(
'id' => 123,
'username' => 'tester',
'email' => '[email protected]'
),
'levelFactory' => new LevelFactory,
'utilities' => new Utilities
));
$output = $dataBuilder->makeData(Level::ERROR, "testing", array());
$this->assertEquals('123', $output->getPerson()->getId());
$this->assertNull($output->getPerson()->getUsername());
$this->assertNull($output->getPerson()->getEmail());
}

public function testPersonFuncException()
{
Expand Down Expand Up @@ -904,7 +923,7 @@ public function testFramesOrder()
);
// 900 is the line number where the comment "// A" is found
$this->assertEquals(
900,
919,
$frames[count($frames)-1]->getLineno(),
"Possible false negative: did this file change? Check the line number for line with '// A' comment"
);
Expand Down

0 comments on commit 0d11475

Please sign in to comment.