Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Tried to install authcache without much luck today ... this is a warning I get when going to edit a user's profile as admin:
Notice: Undefined offset: 0 in _authcache_is_account_cacheable() (line 114 of /var/www/blahblah/modules/authcache/authcache.helpers.inc).
Comment | File | Size | Author |
---|---|---|---|
#3 | 1481036-Undefined-offset-in-authcache_is_account_cacheable.patch | 1.36 KB | znerol |
Comments
Comment #1
simg CreditAttribution: simg commentedI've made quite a few fixes / updates recently, and I don't get this warning.
Am assuming it's fixed ?
Comment #2
DrMiaow CreditAttribution: DrMiaow commentedI'm assuming this is related to the issue I am getting.
Notice: Undefined offset: 1 in _authcache_is_account_cacheable() (line 168 of sites\all\modules\authcache\authcache.helpers.inc).
test for count($extra_roles) == 1
gurantees that $extra_roles[0] exists, but $extra_roles[1] is being accessed.
So either count($extra_roles) needs to be > 1 or $extra_roles[0] needs to be tested.. or something else.
I resolved this by changing line 168 so that
becomes
Which could be wrong. Can you please verify that solution is correct? Thanks.
Comment #3
znerol CreditAttribution: znerol commentedThe intention of this piece of code is to only take the "authenticated user" role into account when the user does not have any additional roles. The current implementation does not look to trustworthy and I've rewritten this part for the 2.x version. I've backported the new mechanism into the 1.x-tree (see attached patch). Would you mind testing it on the affected installation and report back whether it works?
Comment #4
znerol CreditAttribution: znerol commentedComment #5
znerol CreditAttribution: znerol commentedCommitted: 0d90771.