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.
In some scenarios, the logout action triggers this warning:
Notice: Trying to get property of non-object in entitycache_user_logout() (line 408 of /www/pfw/releases/20140912130110/profiles/pfwprofile/modules/contrib/entitycache/entitycache.module)
This happens because hook_user_logout is trying to be cache_clear $account without checking previously that this object exists and has this field.
Comment | File | Size | Author |
---|---|---|---|
#12 | 2341355-12.patch | 963 bytes | mcdruid |
#10 | phpwarnings-when-logout-2341355-2.patch | 1023 bytes | parasolx |
| |||
#7 | 2341355-php-notice-style.patch | 999 bytes | greggles |
| |||
#3 | phpwarnings-when-logout-2341355-9162945.patch | 995 bytes | alexmoreno |
|
Comments
Comment #1
alexmoreno CreditAttribution: alexmoreno commentedComment #2
alexmoreno CreditAttribution: alexmoreno commentedFix attached.
Comment #3
alexmoreno CreditAttribution: alexmoreno commentedComment #4
recrit CreditAttribution: recrit commentedComment #5
alansaviolobo CreditAttribution: alansaviolobo at Axelerant commentedpatch works well.
Comment #6
hussainwebNitpick: Space after 'if' in this block and the next two.
Also, the condition could be simply collapsed to 'if (isset($account->uid))'
This can be fixed on commit.
Comment #7
gregglesHere's a reroll to add a space after the if and remove the parentheses which look unnecessary to me.
Comment #8
hussainwebThanks for the fixes. The above could just be
isset($account->uid)
, or if you care about 0 values,!empty($account->uid)
Comment #9
Chris CharltonBump.
Comment #10
parasolx CreditAttribution: parasolx as a volunteer and at Hadafi Solution & Resources commentedAgree with hussainweb.
isset($account->uid)
is enough to check either the uid is valid or not. So i just reattach the modified version with!empty(account->uid)
Comment #11
DamienMcKennaThe latest patch needs to be reviewed.
Comment #12
mcdruidI think @hussainweb was suggesting that the condition can be simply:
...which I think makes sense.
Comment #14
mcdruidThanks everyone!