-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Person TypeError #73
Comments
@MeekLogic thanks for bringing this to our attention. @ArturMoczulski can you take a look at this? |
I have created a PR for this – #75 |
I realize this is closed, but just ran into an interesting caveat related to this error. Figured I'd share this information in case anyone else runs into the same issue. My configuration is as follows:
And by all accounts, was functioning just fine. But, my
By default, that shouldn't do anything innocuous, as
When called as
Behind the scenes, Laravel has logic to translate methods to properties, which is why both
Now, the check |
AFAIK, Laravel returns models in an object format and Rollbar-PHP-Laravel doesn't seem to handle this properly.
Using this from the docs:
'person_fn' => 'Auth::user'
Gives this error:
Argument 4 passed to Rollbar\Payload\Person::__construct() must be of the type array or null, object given, called in C:\inetpub\wwwroot\oim-laravel\vendor\rollbar\rollbar\src\DataBuilder.php on line 894
Fixed by extending MonologHandler.php line 47 to serialize object to array:
$person = call_user_func($config['person_fn'])->toArray();
The only reason I didn't submit a PR is that I don't like my solution as it expects to receive a Laravel model in return. I could add some elaborate type checking but wanted to see if anyone else is having this issue (albeit no results on issue tracker) and how they solved it.
I also tried:
However, Laravel complained about closures when compiling cache.
The text was updated successfully, but these errors were encountered: