Closed matt-h closed 2 years ago
👋🏽 we will follow up, @matt-h -- thanks for reporting.
Hi @matt-h, thank you for opening this issue!
In rollbar/rollbar
v3.0.0 we added strong typing to this property as a string
. This may have been a mistake. It should probably be a union type string | int
. It seems pretty reasonable that the ID would be an int
for relational DBs and a string
for document DBs.
If we were not using constructor property promotion, the constructor could accept and string | int
and then cast an int
to a string
. This would allow us to strongly type the property as a string
. It looks like it should be a string in the API docs.
I feel like this would be the simplest solution. Are there any there primitive types we should natively support other than string
and int
that we reasonably believe people could use as IDs?
I can't think of anything besides string
or int
that would be used as an ID.
It might make sense to keep the ID in src/Payload/Person.php
as a string.
And then here: https://github.com/rollbar/rollbar-php/blob/4cf5c77c7b9be5e7fb3223361faa7fa2442c6cbd/src/DataBuilder.php#L916 Cast it to a string.
Casting to a string in the DataBuilder
class is great idea. I double checked to make sure it is the only place we instantiate a Person
instance. It is the only place. I have created a PR https://github.com/rollbar/rollbar-php/pull/562 with the solution.
Thank you @matt-h for your help on this!
I have released v3.1.2 which should resolve the issue.
@danielmorell have you bumped rollbar-laravel aswell ?
Hi @chrillep, No. I have not. There should be no need. You can simply run the following terminal command in your project directory.
$ composer update rollbar/rollbar
It should update rollbar/rollbar
to v3.1.2.
Hi @chrillep, No. I have not. There should be no need. You can simply run the following terminal command in your project directory.
$ composer update rollbar/rollbar
It should update
rollbar/rollbar
to v3.1.2.
@danielmorell yep that worked! cheers! but dependabot didn't pick it up fyi :)
I'm getting the following error every time it tries to log anything to Rollbar. This is using Laravel 8 with the following config.