Problem/Motivation
Drupal core creates the session table lazy on demand, so it does not always exist. When a user logs in with the JWT module and logs out and the session table does not exist yet (during automated test runs for example), then there is a database exception:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.sessions' doesn't exist: ...
Steps to reproduce
1) Install Drupal from scratch, do not login via session. Sessions table does not exist.
2) Login in with JWT (or other login provider)
3) Logout from JWT, trigger hook_user_logout()
4) Database exception happens in ContentLockHooks::userLogout().
Proposed resolution
All direct database queries against the session table must be wrapped with try/catch.
Remaining tasks
Merge request
User interface changes
none
API changes
none
Data model changes
none
| Comment | File | Size | Author |
|---|
Issue fork content_lock-3568535
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3568535-sqlstate42s02-base-table
changes, plain diff MR !100
Comments
Comment #3
klausiMerge request created.
Uploading stable patch file for composer patches.
Comment #4
klausiTests are failing, but only one phpcs error was relevant to this MR.
Comment #5
aurelianzaha commentedthanks for the fix @klausi
Comment #6
aurelianzaha commentedComment #7
rajab natshahRTBC+1
Comment #9
alexpottThanks @klausi - this one is hard to test so I agree we should merge this without one.