ExpressionEngine / ExpressionEngine

ExpressionEngine is a flexible, feature-rich, free open-source content management platform that empowers hundreds of thousands of individuals and organizations around the world to easily manage their web site.

Home Page:https://expressionengine.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Members disappear from Member listing but remain in EE exp_members db table

jcogs-design opened this issue · comments

Description of the problem
User of site (SarahF, Member ID 26) reported no longer being able to log in.
Their entry was still showing in EE exp_members db table, but when log in attempted EE threw an Exception error reporting "Call to a member function getAllRoles() on null" and "Attempt to read property "role_id" on null".

Error Messages


Warning
Attempt to read property "role_id" on null

ee/legacy/libraries/Auth.php, line 637

    Severity: E_WARNING

Warning
Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:120)

ee/ExpressionEngine/Boot/boot.common.php, line 478

    Severity: E_WARNING

Error Caught
Call to a member function getAllRoles() on null

ee/legacy/libraries/Auth.php:643
Stack Trace: Please include when reporting this error

    #0 ee/legacy/libraries/Auth.php(273): Auth_result->has_permission('can_access_cp')
    #1 ee/legacy/controllers/cp/login.php(418): Auth->verify()
    #2 [internal function]: Login->authenticate()
    #3 ee/ExpressionEngine/Core/Core.php(268): call_user_func_array(Array, Array)
    #4 ee/ExpressionEngine/Core/Core.php(124): ExpressionEngine\Core\Core->runController(Array)
    #5 ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
    #6 public_html/admin.php(144): require_once('...')
    #6 public_html/admin.php(144): require_once('...') 

Screenshots / Videos / Template Code
image
image
image

Environment Details:

  • Version: 7.4.9
  • PHP Version 8.1

Possible Solution
Removed member and recreated their account, but not a good solution in bigger picture sense.

@jcogs-design this was a scenario where the exp_members table was in good shape but this specific member did not have an entry on the exp_member_data table which should be added when the member record is created. I haven't been able to see any reason why that didn't happen in your database but a temporary solution would be adding the missing pivot on exp_member_data.

The PR I've opened changes how ExpressionEngine's model gateways work so that this missing pivot record will not cause an error when trying to retrieve the main model and would resolve your issue here as well.

Ace - thanks for the update.
I'm not sure what might have happened to cause the underlying issue - we strongly suspect the 7.4.0 to 7.4.9 update (as the user had not reported any issues prior to this happening, and nothing else much has changed).
Making the model more tolerant of errors in table setup will help for sure - is it likely that the issue would get cleaned up by EE over time (I'm not clear about what happens to add entries to exp_member_data)?