codeigniter4 / shield

Authentication and Authorization for CodeIgniter 4
https://shield.codeigniter.com
MIT License
358 stars 128 forks source link

fix: Call to a member function getErrors() on null in CheckQueryReturnTrait #1088

Closed kenjis closed 6 months ago

kenjis commented 6 months ago

Description Fixes #1087

Since CI 4.5.0, $this->validation may be null.

Checklist:

kenjis commented 6 months ago

@datamweb Ah, if $this->validation is null, the model did not run validation. So, your way is the way to go.

kenjis commented 6 months ago

$this->validation?->getErrors() requires PHP 8.0. Shield still supports PHP 7.4. https://github.com/codeigniter4/shield/blob/0894a161d00d11f7cf863caac3bff53a28795b38/composer.json#L28

datamweb commented 5 months ago

Wait for a new version of Shield to be released, or temporarily use the develop branch:

composer require codeigniter4/shield:dev-develop
quickdunk commented 5 months ago

Thanks for this!