owencutajar:
I’ve encountered the same problem, and it’s not just $userdata that goes empty. I’ve noticed my own global variables go empty as well.
For example sometimes a var_dump($userdata) before header.php is included gives normal results, but it’s empty after inclusion.
I don’t know what causes the problem, but I’ve worked around it by ‘resetting’ userdata to the superglobal $GLOBALS[‘userdata’] as follows:
$userdata = $GLOBALS['userdata'];
or
$myGlobalVariable = $GLOBALS['myGlobalVariable']
Hope this helps.