cartalyst / sentinel

A framework agnostic authentication & authorization system.
BSD 3-Clause "New" or "Revised" License
1.51k stars 238 forks source link

Cartalyst\Sentinel\Users\EloquentUser::getPermissions(): Return value must be of type array, string returned #577

Open jamieisps opened 3 months ago

jamieisps commented 3 months ago

Your Environment

Expected behaviour

Persmissions to be returned

Actual behaviour

Error is Cartalyst\Sentinel\Users\EloquentUser::getPermissions(): Return value must be of type array, string returned

Changing /Users/jamiegill/Repositories/lifestyle-fitness/vendor/cartalyst/sentinel/src/Permissions/PermissibleTrait.php

public function getPermissions(): array { return $this->permissions ?? []; }

To

public function getPermissions(): array { return $this->permissions !== null && $this->permissions !== '' ? $this->permissions : []; }

Seems to resolve this, unsure why a string is returned after the upgrade but thought this may help others.

NOTE - I do not in no way recommend editing vendor packages unfortunately I was in a position I had to do this to get the build working correctly.