hi,

i am seeing some really weird behavior, and i am not sure if i am just brain-dead.

my module has a preprocess_page function, which has been working just fine for all users, anonymous as well as logged in. recently, i added some code to that function that deals with session variables. now it appears that the module_preprocess_page function is not called at all for anonymous users (which may also mean there is no session active, i am not sure - even though i call session_start() in the function). for logged in users it is called just like always.

has anyone seen this behavior? am i missing something regarding sessions and hook_preprocess_page?

any ideas appreciated.

 

Comments

i moved the session handling code out of the preprocess_page function, and into my layout file. that seems to have resolved the issue. so i guess there is some reason sessions cannot be touched in hook_preprocess_page. i may try putting the code into the preprocess_layout function of my module, to see if that has the same issue.

it does seem bizarre to me that the preprocess_page function would simply not get called, nor raise any errors, when the user is anonymous and there is session handling code in there. but i have my workaround, so i'm happy for now.