Problem/Motivation
The session.storage.options parameter does not always define the cookie_lifetime key. This array comes from the service definition (core + settings.php + environment-specific overrides). If the site does not set cookie_lifetime, the key may simply not exist in the array, and accessing it directly will trigger a warning Warning: Undefined array key "cookie_lifetime" in autologout_page_attachments_alter() (line 256 of modules/contrib/autologout/autologout.module).
Steps to reproduce
1. Upgrade to latest version
2. Log in
Proposed resolution
Check the access to session options to avoid warnings when cookie_lifetime is not defined, using a safe fallback. This eliminates the “Undefined array key” notice without changing the expected behavior when the key is present.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork autologout-3580557
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:
Comments
Comment #2
jonathandealmeida commentedI pushed a fix for the undefined array key warning related to cookie_lifetime.
This change adds a fallback when the key is not defined in session.storage.options.
Branch: 3580557-undefined-array-key
Comment #3
deaom commentedThe issue of the lifetime cookie is already addressed in #3580058: Undefined array key "cookie_samesite" warning after upgrade to 2.02. Also in issue summary the first step to reproduce is upgrade to latest version, which is 2.x and then the issue is opened as a 8.x version. Basically needs to be closed as a duplicate, but leaving that to maintainers.
Comment #4
the_g_bomb commentedThis has been fixed in #3580058: Undefined array key "cookie_samesite" warning after upgrade to 2.02
Comment #6
joshahubbers commentedSorry, but I applied the patch in #3580058: Undefined array key "cookie_samesite" warning after upgrade to 2.02, and it does fix the issue in autologout_user_login(), but not inautologout_page_attachments_alter().
My bad, I did not apply the patch propery.