Laravel-debugbar: ReflectionFunction::__construct() expects parameter 1 to be string, array given

Created on 6 Sep 2018  Â·  7Comments  Â·  Source: barryvdh/laravel-debugbar

When using policies in Laravel 5.7 I get the above mentioned error. (Debugbar v3.2)
It also happens on a fresh copy of Laravel.

It's thrown in Illuminate\Auth\Access\Gate.php @ callbackAllowsGuests
Parameter passed to the ReflectionFunction constructor:
array:2 [â–¼
0 => GateCollector
1 => "addCheck"
]

It happens only when there is no authenticated user.

It occurs when calling the authorize method in the controller:
$this->authorize('action', $model);

And when using the @can blade directive
@can('view', $model)

Most helpful comment

Setting gate collector to false in debugbar's config seems to fix the issue.

All 7 comments

Setting gate collector to false in debugbar's config seems to fix the issue.

Same issue, posted on Laracasts and found afterwards it was coming from Debugbar
For more information : https://laracasts.com/discuss/channels/laravel/laravel-57-policy-issue

is there way to fix this? because gate collection is much helpful when finding a failed permission

Same issue. I'd never known If i didn't find this posts

Same issue. This posts are very helpful

Setting gate collector to false in debugbar's config seems to fix the issue.

You can uninstall Debugbar, it will fix the issue too

Same issue for me..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beneverard picture beneverard  Â·  6Comments

thomthom picture thomthom  Â·  5Comments

truongthaison picture truongthaison  Â·  4Comments

hookover picture hookover  Â·  4Comments

linaspasv picture linaspasv  Â·  5Comments