You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon upgrading to 8.65.0 this morning I noticed build failures, and I believe it's related to changes to the authorization gate. It looks to me as though it affects controller calls to authorize but not @can in views.
The simplest example in my app is creating a Block record - for one user to block another user. I have been using a BlockPolicy and passing the other user as an additional argument into the create method.
Error: Method name must be a string in /Users/Dwight/Sites/roomies/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php:818
Stack trace:
#0 /Users/Dwight/Sites/roomies/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php(488): Illuminate\Auth\Access\Gate->Illuminate\Auth\Access\{closure}(Object(App\Models\User))
#1 /Users/Dwight/Sites/roomies/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php(383): Illuminate\Auth\Access\Gate->callAuthCallback(Object(App\Models\User), Array, Array)
#2 /Users/Dwight/Sites/roomies/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php(348): Illuminate\Auth\Access\Gate->raw(Array, Array)
#3 /Users/Dwight/Sites/roomies/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php(335): Illuminate\Auth\Access\Gate->inspect(Array, Array)
#4 /Users/Dwight/Sites/roomies/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php(23): Illuminate\Auth\Access\Gate->authorize(Array, Array)
#5 /Users/Dwight/Sites/roomies/app/Http/Controllers/BlockController.php(15): App\Http\Controllers\Controller->authorize(Array)
At first glance - the API I'm using in the controller is wrong. I would have expected it to be more along the lines of $this->authorize(Block::class, [$user]), however this is what has been working for a long time now. Now it appears that whatever way I try additional arguments are lost.
Comparing the output of $abilities, $arguments after the call to authorize in AuthorizesRequests:
Description:
Upon upgrading to 8.65.0 this morning I noticed build failures, and I believe it's related to changes to the authorization gate. It looks to me as though it affects controller calls to
authorize
but not @can in views.The simplest example in my app is creating a
Block
record - for one user to block another user. I have been using aBlockPolicy
and passing the other user as an additional argument into thecreate
method.At first glance - the API I'm using in the controller is wrong. I would have expected it to be more along the lines of
$this->authorize(Block::class, [$user])
, however this is what has been working for a long time now. Now it appears that whatever way I try additional arguments are lost.Comparing the output of
$abilities, $arguments
after the call toauthorize
inAuthorizesRequests
:Laravel 8.64.0:
Laravel 8.65.0
Opening an issue to see if it's affected others or if there are better solutions. I'll look into options to rectify this.
The text was updated successfully, but these errors were encountered: