Skip to content
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

Bug: [CI 4.5.0] After registration/login, "Error: Call to a member function getErrors() on null" #1087

Closed
GeneralFutz opened this issue Apr 7, 2024 · 2 comments · Fixed by #1088
Labels
bug Something isn't working

Comments

@GeneralFutz
Copy link

PHP Version

8.2.4

CodeIgniter4 Version

4.5.0

Shield Version

1.0.2

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MariaDB 10.4-28

Did you customize Shield?

No

What happened?

After updating to Codeigniter 4.5 through composer update, (and copying the required files), also after and fresh installation of a new project through Composer, the Login and Register pages return the following error:

Call to a member function getErrors() on null

  1. VENDORPATH\codeigniter4\shield\src\Models\CheckQueryReturnTrait.php : 31 — CodeIgniter\Shield\Models\BaseModel->checkValidationError ()
  2. VENDORPATH\codeigniter4\shield\src\Models\UserIdentityModel.php : 92 — CodeIgniter\Shield\Models\BaseModel->checkQueryReturn
  3. VENDORPATH\codeigniter4\shield\src\Entities\User.php : 145 — CodeIgniter\Shield\Models\UserIdentityModel->createEmailIdentity
  4. VENDORPATH\codeigniter4\shield\src\Entities\User.php : 175 — CodeIgniter\Shield\Entities\User->createEmailIdentity
  5. VENDORPATH\codeigniter4\shield\src\Models\UserModel.php : 358 — CodeIgniter\Shield\Entities\User->saveEmailIdentity
  6. SYSTEMPATH\BaseModel.php : 1695 — CodeIgniter\Shield\Models\UserModel->saveEmailIdentity
  7. SYSTEMPATH\BaseModel.php : 850 — CodeIgniter\BaseModel->trigger
  8. SYSTEMPATH\Model.php : 790 — CodeIgniter\BaseModel->insert
  9. VENDORPATH\codeigniter4\shield\src\Models\UserModel.php : 265 — CodeIgniter\Model->insert
  10. SYSTEMPATH\BaseModel.php : 751 — CodeIgniter\Shield\Models\UserModel->insert
  11. VENDORPATH\codeigniter4\shield\src\Models\UserModel.php : 327 — CodeIgniter\BaseModel->save
  12. VENDORPATH\codeigniter4\shield\src\Controllers\RegisterController.php : 115 — CodeIgniter\Shield\Models\UserModel->save
  13. SYSTEMPATH\CodeIgniter.php : 933 — CodeIgniter\Shield\Controllers\RegisterController->registerAction
  14. SYSTEMPATH\CodeIgniter.php : 509 — CodeIgniter\CodeIgniter->runController
  15. SYSTEMPATH\CodeIgniter.php : 355 — CodeIgniter\CodeIgniter->handleRequest
  16. SYSTEMPATH\Boot.php : 312 — CodeIgniter\CodeIgniter->run ()
  17. SYSTEMPATH\Boot.php : 67 — CodeIgniter\Boot::runCodeIgniter
  18. FCPATH\index.php : 56 — CodeIgniter\Boot::bootWeb

The registration was successful with a new entries in the users and identities tables.

When a validation error does occur, the proper errors are displayed as intended.

Steps to Reproduce

As said above this happened after composer update and new installation of latest Codeigniter version. No changes to Shield Controllers or routes.

Expected Output

We should be redirected to the default pages on success.

Anything else?

No response

@GeneralFutz GeneralFutz added the bug Something isn't working label Apr 7, 2024
@datamweb
Copy link
Collaborator

datamweb commented Apr 7, 2024

Temporarily check with the change below.

$validationErrors = $this->validation->getErrors();

$validationErrors = service('validation')->getErrors();

@kenjis kenjis changed the title Bug: After registration/ login, "Error: Call to a member function getErrors() on null" Bug: After registration/login, "Error: Call to a member function getErrors() on null" Apr 8, 2024
@kenjis kenjis changed the title Bug: After registration/login, "Error: Call to a member function getErrors() on null" Bug: [CI 4.5.0] After registration/login, "Error: Call to a member function getErrors() on null" Apr 8, 2024
@kenjis
Copy link
Member

kenjis commented Apr 8, 2024

I sent #1088

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants