Following a discussion on the dev mailing list:
user_access() believe that unsetting a static will reset it. But it's not the way PHP works (the unset is only temporary to the function call in that case).
Given the strange internal logic of user_access(), this only hurts in the case when $account->uid = 1, or when $account = NULL and the current user is #1, because in these two cases, the function returns before reassigning something to $perm.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 329646-user-module-reset.patch | 514 bytes | damien tournoud |
| #1 | 329646-user-module-reset-d6.patch | 525 bytes | damien tournoud |
Comments
Comment #1
damien tournoud commentedHere is a patch for this. I'm also working on a test.
Comment #2
Anonymous (not verified) commentedUsing unset on a static variable only ``unsets'' the variable from the point of the unset. The values prior to the unset still exist. This patch provides the intended behavior.
Comment #3
drewish commentedi found earnie's explanation unclear. the php.net docs for unset() helped me understand the problem:
Comment #4
gábor hojtsyAgreed that this looks RTBC, awaiting Drupal 7 commit to commit to Drupal 6.
Comment #5
dries commentedGood catch. Ideally, we would have written a test for this though...
Committed to CVS HEAD and DRUPAL-6. Thanks.